我正在尝试在 python 中编写一个 vigenere 密码加密器。我收到另一个错误...
def vigenere(string,key):
for i in range(len(key)):
if key[i].isupper():
tempList = list(key)
tempList[i] = chr(ord(key[i])-65)
key = "".join(tempList)
elif key[i].islower():
tempList = list(key)
tempList[i] = chr(ord(key[i])-97)
key = "".join(tempList)
k = 0
newstring = ''
for i in string:
if i.isupper():
newstring = newstring + ((ord(i)-65)+(key[k % len(key)]))%26 + 65
elif i.islower():
newstring = newstring + ((ord(i)-97)+(key[k % len(key)]))%26 + 97
k = k + 1
return newstring
“+ 不支持的操作数类型:'int' 和 'str'”——有什么帮助吗?