【发布时间】:2014-03-24 12:04:27
【问题描述】:
我的加密几乎可以正常工作,但并不完全:
d1={'H':'Z','E':'P','l':'O','O':'J'}
def encrypt(table,string):
encrypted=""
for k,v in table.iteritems():
k=string[0:]
encrypted+=v
return encrypted
print encrypt(d1,"HELLO")
这将返回“ZPOJ”。它需要返回“ZPOOJ”。我怎样才能使这项工作? 谢谢。
【问题讨论】:
-
"这将返回“ZPOJ”。它需要返回“ZPOJ”。我在这里遗漏了什么吗?你的输出和你需要的是一样的。
-
已修复。谢谢,对此感到抱歉。
-
没问题,你可能会得到更多帮助,以及标记这是用什么语言编写的
标签: python encryption dictionary