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)
我將如何解碼的字符串通過這個編碼的代碼?
剛剛反轉邏輯 –