python的新手......真的对这个奇怪的错误感到困惑......我不认为我做错了什么,是吗?
主文件
from methods import Reverse
def main ():
b = [1,2,3,4,5,6,6,7,8,8,9,1,212,312,31,23,123455435,56,56,123]
a = "llaa"
thing = Reverse()
print thing.reverse(a)
main()
方法.py
class Reverse():
def __init__(self):
print "initialized reverse"
def reverse(self,var):
if var == "":
return var
else:
print var[-1] + reverse(var[:-1])
我正在尝试使用反向进行递归调用......请帮助。谢谢!