pythonchallenge-1地址 : http://www.pythonchallenge.com/pc/def/274877906944.html图片如下: 题目解析:看图也不懂是什么意思,于是看一下攻略。题目意思:把每个字符位移两次,例如:K→M解题过程:
import re def charshitf(aa): p1=re.compile(‘[a-x]‘) if p1.match(aa): return chr(ord(aa)+2) elif aa == ‘y‘: return ‘a‘ elif aa == ‘z‘: return ‘b‘ else: return aa straa = "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. " strbb = "" strcc = "map" for i in strcc: strbb = strbb +charshitf(i) print(strbb)
答案:通过解译页面的文本内容得出: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.实际上只要解译 map字符即可,map→ocr心得:使用了正则表达式,引用了re。 整个程序不够简练,等有空了在来调整一下
时间: 2024-11-12 01:24:46