【发布时间】:2014-07-13 19:34:56
【问题描述】:
有一个关于这个错误的问题:
TypeError: rot13() takes exactly 1 argument (2 given)
在此代码上发生的情况:
def get(self): <-- called on every get request
ch = self.rot13("abc")
def rot13(input): <-- fairly untested rot 13 ;)
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
escaped = escape(input)
ciphered = ""
for char in escaped:
originalIndex = alpha.index(char)
newIndex = (originalIndex + 13) % 26
ciphered = chipered + alpha[newIndex]
不知道为什么会出现这个错误。我只是在那里处理一个参数。
【问题讨论】:
标签: python-2.7 webapp2