我被要求创建一个对输入进行加密的程序。我已经考虑过创建一个程序,但没有太多关于如何做。看起来不应该太复杂,但我的课上没有教过我任何一个。我也读过这篇文章Get character position in alphabet,但运气不太好!到目前为止,我有这个:import sys
import os
import time
import string
def Cryption():
####################
encrypt = 'encrypt'
decrypt = 'decrypt'
####################
s = raw_input("Would you like to encrypt or decrypt? Enter your answer")
if encrypt in s:
print("Loading encryption sector...")
time.sleep(2)
enc = raw_input("Please input the string you would like to encrypt")
print ("Your decrypted word is: " + enc)
if decrypt in s:
print("Loading decryption sector...")
time.sleep(2)
dec = raw_input("Please input the string you would like to decrypt")
else:
print("Your input was invalid, please re-enter your choice!")
r = raw_input("Press enter to restart your program")
Cryption()
Cryption()
我在想,如果我把每一个字母的值加上5,然后重新打印产品。我将使用哪些函数将5加到字母表的顺序上?ord()?如果是这样的话,有人能告诉我如何使用它吗?提前谢谢!在