http://www.pythonchallenge.com/pc/def/ocr.html
- find the mess message in the page source (commend), copy the content and save it as a file
f = open("filename.txt", "r") dict = {} for line in f: line_list = list(line) for i in line_list: dict[i] = (dict[i]+1) if (i in dict) else 1
- the result shows:
:1219
!: 6079
#: 6115
%: 6104
$: 6046
&: 6043
): 6186
(: 6154
+: 6066
*: 6034
@: 6157
[: 6108
]: 6152
_: 6112
^: 6030
a: 1
e: 1
i: 1
l: 1
q: 1
u: 1
t: 1
y: 1
{: 6046
}: 6105
- find that some letters only show once (so called rare characters), but still don't know the order, find the order
- find that some letters only show once (so called rare characters), but still don't know the order, find the order
ans = '' for line in f: line_list = list(line) for i in line_list: if dict[i] == 1: ans = ans + i print ans
- the answer is "equality"
- it's occurred to me that I should use regular expression ;( Never mind! It will be used in the next level.
- it's occurred to me that I should use regular expression ;( Never mind! It will be used in the next level.
沒有留言:
張貼留言