0
这是我用来编码它我将如何解码由此程序编码的字符串?
import string
def encode(text,rotate_by):
s_from = string.ascii_lowercase + string.ascii_uppercase
s_to = (string.ascii_lowercase[rotate_by:] +
string.ascii_lowercase[:rotate_by] +
string.ascii_uppercase[rotate_by:] +
string.ascii_uppercase[:rotate_by])
cypher_table = string.maketrans(s_from, s_to)
cypher_table = string.maketrans(s_from, s_to)
return text.translate(cypher_table)
text = raw_input("Enter the text to encode: ")
rotate_by = int(raw_input("Rotate by: "))
print encode(text, rotate_by)
我将如何解码的字符串通过这个编码的代码?
刚刚反转逻辑 –