Python Challenge (level 1)
URI: http://www.pythonchallenge.com/pc/def/map.htmlhttp://lampeter123.iteye.com/upload/attachment/120134/9c3ddaba-a452-32c5-aee1-5ab469f09223.jpg
说明:
图片中显示出字符转换的规律k->m, o->q, e->g
提示用string.maketrans()
解决方法:
import string
original = "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."
table = string.maketrans(
"abcdefghijklmnopqrstuvwxyz", "cdefghijklmnopqrstuvwxyzab"
)
print original.translate(table)
i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that’s why this text is so long. using string.maketrans() is recommended. now apply on the url.
print "map".translate(trans)
ocr
过关答案:
ocr
页:
[1]