Challenge 2

First of all I checked the lib to see if there’s an OCR module, looks no, at least not in the standard distribution :)

OK, it says to find the rare chars, so here is my first try:

f = open("mess.txt", "r")

ss = {}

for c in f.read():
if ss.has_key(c):
ss[c] += 1
else:
ss[c]=1
And here is the output:

In [6]: ss
Out[6]:
{’\n’: 1220,
‘!’: 6079,
‘#’: 6115,
‘$’: 6046,
‘%’: 6104,
‘&’: 6043,
‘(’: 6154,
‘)’: 6186,
‘*’: 6034,
‘+’: 6066,
‘@’: 6157,
‘[’: 6108,
‘]’: 6152,
‘^’: 6030,
‘_’: 6112,
‘a’: 1,
‘e’: 1,
‘i’: 1,
‘l’: 1,
‘q’: 1,
‘t’: 1,
‘u’: 1,
‘y’: 1,
‘{’: 6046,
‘}’: 6105}

I tried http://www.pythonchallenge.com/pc/def/aeilqtuy.html and got a 404. I think I need to preserve the order. Anyway they are all lower case chars so

import string

f = open(”mess.txt”, “r”)

out = [c for c in f.read() if c in string.ascii_lowercase]
And here is what I got:

In [15]: out
Out[15]: [’e', ‘q’, ‘u’, ‘a’, ‘l’, ‘i’, ‘t’, ‘y’]

http://www.pythonchallenge.com/pc/def/equality.html, got it!

The hit is: One small letter, surrounded by EXACTLY three big bodyguards on each of its sides.

The title is “re”. So this is re related. But I don’t know what the hit means and decided to take a look at the page source. Ah, there’s a mess in there, again!

So tomorrow, I’ll use re to search the mess and find some patien, maybe a lower case surounded by three upper case or something similiar.

Tags: , ,

Post a Comment

You could use <code type="name"> to get your code colorized

Your email is never published nor shared. Required fields are marked *

Close
E-mail It