【Python Challenge-1】trans

来源:互联网 发布:2018年云计算展会 编辑:程序博客网 时间:2024/05/01 02:10

K --> M

O --> Q 

E --> G

所有ASCII码都加2,Y,Z回头。

推荐用string.maketrans(),所以就用呗- -、


def decode(text):    trans = string.maketrans('abcdefghijklmnopqrstuvwxyz', 'cdefghijklmnopqrstuvwxyzab')    text = text.translate(trans)    return 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.

用一次decode得到:

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'用一次decode得到‘ocr’



0 0
原创粉丝点击