为什么我这样会报错
class Fib(object):
def __init__(self, num):
a=0
b=1
L=[]
for n in range(num):
L.append(a)
a,b=b,a+b
def __str__(self):
return str(L)
__repr__=__str__
def __len__(self):
return len(L)
f = Fib(10)
print f
print len(f)
class Fib(object):
def __init__(self, num):
a=0
b=1
L=[]
for n in range(num):
L.append(a)
a,b=b,a+b
def __str__(self):
return str(L)
__repr__=__str__
def __len__(self):
return len(L)
f = Fib(10)
print f
print len(f)
2018-09-27
举报