python 迭代器
from collections import Iterator
class IterA(Iterator):
def __init__(self,Itlist):
self.Itlist = Itlist
self.index = 0
def next(self):
if self.index == len(self.Itlist):
raise StopIteration
a = self.Itlist[self.index]
self.index +=1
return a