Well, it said EXACTLY three big bodyguard, so the first try is like this:
target = re.compile(r”[!A-Z][A-Z]{3}([a-z])[A-Z]{3}[!A-Z]”)
f = open(”mess.txt”, “r”)
myout = target.findall(f.read())
And I got this:
[’e', ‘i’, ‘z’, ‘r’, ‘v’, ‘g’, ‘b’, ‘m’, ’s’, ‘z’, ‘u’, ‘o’, ‘w’, ‘i’, ‘b’, ‘z’, ‘b’, ‘c’, ‘j’, ‘g’, ‘d’, ‘o’, ‘h’, ‘l’, ‘
z’, ‘x’, ‘j’, ‘v’, ‘e’, ‘g’, ‘f’, ‘q’, ‘b’, ‘i’, ‘i’, ‘a’, ‘v’, ‘j’, ‘j’, ‘g’, ‘t’, ‘c’, ‘j’, ‘k’, ‘g’, ‘c’, ‘l’, ‘g’, ‘m’
, ’s’, ‘n’, ‘j’, ‘j’, ‘m’, ‘z’, ‘z’, ’s’, ’s’, ‘q’, ‘q’, ‘q’, ‘l’, ‘i’, ‘j’, ‘z’, ‘f’, ‘a’, ‘l’, ‘j’, ‘p’, ‘x’, ‘j’, ‘t’,
‘k’, ’s’, ‘a’, ‘q’, ‘e’, ‘o’, ‘c’, ‘t’, ‘c’, ‘n’, ‘w’, ‘x’, ‘y’, ‘l’, ‘l’, ‘g’, ‘b’, ‘f’, ‘m’, ‘i’, ‘w’, ‘k’, ‘f’, ‘i’, ‘u
‘, ‘z’, ‘j’, ‘g’, ‘t’, ‘f’, ‘d’, ‘p’, ‘e’, ‘j’, ’s’, ‘b’, ‘y’, ‘u’, ’s’, ‘m’, ‘i’, ‘j’, ‘j’, ‘o’, ‘p’, ‘e’, ’s’, ’s’, ‘j’,
‘n’, ‘t’, ‘h’, ’s’, ‘m’, ‘o’, ‘x’, ‘v’, ‘j’, ‘k’, ‘g’, ‘u’, ‘d’, ‘w’, ‘t’, ‘f’, ‘b’, ‘e’, ‘a’, ‘u’, ‘n’, ‘g’, ‘p’, ‘i’, ‘
b’, ‘k’, ‘j’, ‘n’, ‘i’, ‘k’, ‘x’, ‘g’, ‘i’, ‘b’, ‘l’, ‘a’, ‘z’, ‘l’, ‘i’, ‘c’, ‘d’, ‘j’, ‘g’, ‘u’, ‘o’, ‘j’, ‘v’, ‘e’, ‘l’
, ‘y’, ‘i’, ‘d’, ‘o’, ‘m’, ‘f’, ‘m’, ‘k’]
What’s this? Checked the mess again and there’s no punctuation in it. Is the URL so long?
Out[12]: ‘eizrvgbmszuowibzbcjgdohlzxjvegfqbiiavjjgtcjkgclgmsnjjmzzssqqqlijzfaljpxjtksaqeoctcnwxyllgbfmiwkfiuzjgtfdpejsbyus
mijjopessjnthsmoxvjkgudwtfbeaungpibkjnikxgiblazlicdjguojvelyidomfmk’
The loooooong.html doesn’t work. Should I ignore the “\n”?
Wait.. that “!” in the RE!… I’ve been in C these days
So here is the next version:
target = re.compile(r”[^A-Z][A-Z]{3}([a-z])[A-Z]{3}[^A-Z]”)
f = open(”mess.txt”, “r”)
myout = “”.join(target.findall(f.read()))
And I got
Out[41]: ‘linkedlist’
OK, http://www.pythonchallenge.com/pc/def/linkedlist.html ! It told me to go to http://www.pythonchallenge.com/pc/def/linkedlist.php. This is Challenge 4!
There’s no hint in Challenge 4. The title is “follow the chain”. Well, I clicked on the image and it brings me to http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=12345 “and the next nothing is 92512″. OK, http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=92512. OK, 64505. 50010, 29193, …
Wait, on http://www.pythonchallenge.com/pc/def/linkedlist.php?nothing=64505, it says “Your hands are getting tired and the next nothing is 50010″. I didn’t notice this and keep following the numbers for a while. Now I think I should make a script to do it. Tomorrow
Tags: python_challenge, python, python-challenge, regex
Post a Comment
You could use <code type="name"> to get your code colorized