[解决方案] pythonchallenge level 1

http://www.pythonchallenge.com/pc/def/map.html

 

g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj.

 

abcdefghijklmnopqrstuvwxyz

k+2=m

o+2=q

>>>import string

>>>text="""g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj. """

-1: >>>rule=string.maketrans(string.ascii_lowercase,string.ascii_lowercase[2:]+string.ascii_lowercase[:2])

-2: >>>rule=string.maketrans('abcdefghijklmnopqrstuvwxyz','cdefghijklmnopqrstuvwxyzab')

>>>string.translate(text,rule)

"i hope you didnt translate it by hand. thats what computers are for. doing it i
n by hand is inefficient and that's why this text is so long. using string.maket
rans() is recommended. now apply on the url. "

>>>a='map'  #apply on the url,url的值是map

>>>string.translate(a,rule)

ocr

http://www.pythonchallenge.com/pc/def/ocr.html

posted on 2015-05-03 16:24  hsp  阅读(234)  评论(0编辑  收藏  举报