标签:
题目:
解题思路:
根据图中的K→M,O→Q,E→G,我们可以发现K,O,E这三个字母都向后移动了2位。据说恺撒率先使用了这一加密方法,因此将其命名为恺撒密码。它的基本思想是:通过把字母移动一定的位数来实现加密和解密。
实现方法:
import string old_chr = "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." a = string.lowercase b = a[2:] + a[:2] a_to_b = string.maketrans(a,b) new_chr = string.translate(old_chr,a_to_b) print new_chr
方法解释:
输出:
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.
最后,应用此方法到url中的map,将map改为ocr即可进入下一关。
标签:
原文地址:http://www.cnblogs.com/glorywu/p/PythonChallenge-1.html