class Fab(object):
def __init__(self ,max ):
self.max =max
self.n =0
self.a=0
self.b =1
def __iter__(self): #迭代器,表示为容器,相当于声明
return self
def __next__(self): #迭代内容
print('n=',self.n)
self.n=1+self.n
if self.n < self.max:
out = self.b
return out
# raise StopIteration()
c=0
for i in Fab(13):
c=1+c
print(i)
print('c=',c)
if c>20:
# a = Fab(3)
# print(a)
break