Python Challenge 1

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


图片中提示 K->M  O->Q  E->G
下面给了一段话 看起来是加密过了的 根据提示可以知道 每个字母后移了2位
使用string和maketrans可以解决此问题
解密出来的文字提示使用这个规律解密地址 将map解密后得到 ocr即下一关地址

>>> import string  
>>> l = string.lowercase  
>>> t = string.maketrans(l, l[2:] + l[:2])  
>>> m = """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."""  
>>> print m.translate(t)  
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(t)  
ocr

下一关地址:
http://www.pythonchallenge.com/pc/def/ocr.html

原文地址:https://www.cnblogs.com/pylemon/p/2029429.html