【发布时间】:2018-10-05 06:50:35
【问题描述】:
下面是我的带有 ESP8266 的 NodeMCU 板上发生的事情:
>>> x = iter((28,75,127,179))
>>> x.next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'iterator' object has no attribute 'next'
自定义生成器也是如此:
>>> def foo():
... for i in (28,75,127,179):
... yield i
...
...
...
>>> foo
<generator>
>>> f = foo()
>>> f.next()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'generator' object has no attribute 'next'
这似乎可行,因为对象确实被识别为生成器/迭代器。那么问题来了,我该怎么做呢?
【问题讨论】:
标签: esp8266 nodemcu micropython