python3和python2 中生成器 next()函数的区别

  • 在python3 中next()函数,的调用方法是,把生成器的对象以参数形式传入到next(params),
  • 在Python2 中,以demo.next()调用。demo 是一个生成器对象。
  • Python2 中的调用next()方法:
  • python3 中调用next()方法:

猜你喜欢

转载自blog.csdn.net/weixin_44224529/article/details/89395837