#_*_coding:utf-8_*_
__author__ = 'Linhaifeng'
class Foo:
    def __init__(self,x):
        self.x=x

    def __iter__(self):
        return self

    def __next__(self):
        n=self.x
        self.x+=1
        return self.x

f=Foo(3)
for i in f:
    print(i)

简单示范
简单示范

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
  • 2022-12-23
猜你喜欢
  • 2021-05-25
  • 2021-06-16
  • 2022-12-23
  • 2021-09-20
  • 2021-07-21
  • 2022-12-23
相关资源
相似解决方案