所以我一直在尝试为我的朋友和我的密码制作一个 python 程序(加入了 2 个不同的密码),我一直在努力让加密不同的字符串变得容易,而无需每次都打开和关闭程序。我在 64 位 Windows 7 计算机上使用 python 3.2。
这是我的代码(也请给我一些完善它的提示):
#!/usr/bin/python
#from string import maketrans # Required to call maketrans function.
print ("Welcome to the Rotten Bat encription program. Coded in python by Diego Granada")
answer = input("Please enter the password: ")
if answer == 'raindrops':
print("Password accepted")
else:
print ("Incorrect password. Quiting")
from time import sleep
sleep(3)
exit()
intab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
outtab = "N9Q2T1VWXYZ7B3D5F8H4JK60n9pq2st1vwxyz7b3d5f8h4jk60"
message = input("Put your message here: ")
print(message.translate(dict((ord(x), y) for (x, y) in zip(intab, outtab))))
print ("Thank you for using this program")
input()