- See also: https://docs.python.org/2/library/re.html
- As the previous level, copy the mess message in the page source
- Try to find " 3 uppercase + 1 lowercase + 3 uppercase" pattern
- For example, "AAAaAAA"
- They emphasize "EXACTLY 3 bodyguards," so string like "AAAAaAAA" is not acceptable
- Finally, concat all lowercase letters
import re f = open("filename.txt", 'r') pattern = re.compile('[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]') ans = '' for line in f: result = re.findall(pattern, line) ans = ans + ''.join(result) print ans f.close()- The answer is "linkedlist"
沒有留言:
張貼留言