Python Challenge攻略之Level 2

攻略:

查看网页源代码,你就可以看到一堆字符,只要在里面找出rare characters(出现次数最少的字符)就可以了。

代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env/python
#coding:utf8
'''
Created on May 2, 2013

@author: killua
@url: http://www.pythonchallenge.com/pc/def/ocr.html
@target: http://www.pythonchallenge.com/pc/def/equality.html
'''

import re

data = open('./input/level02.in').read()

res = re.findall(r"[A-Za-z]", data)
print ''.join(res)

完整代码:

Github:https://github.com/zhenlohuang/python-challenge

坚持原创技术分享,您的支持将鼓励我继续创作!