TypeError: iter() returned non-iterator of type
来源:互联网 发布:界面汉化软件 编辑:程序博客网 时间:2024/06/08 06:20
</pre><strong>TypeError: iter() returned non-iterator of type</strong><p></p><pre name="code" class="python">class Fibs: def __init__(self): self.a = 0 self.b = 1 def next(self): #python3.0以后用__next__方法代替next方法 self.a, self.b = self.b, self.a + self.b return self.a def __iter__(self): return self
</pre><pre name="code" class="python">
>>> fibs = Fibs()>>> for f in fibs:if f > 1000:print(f)breakTraceback (most recent call last): File "<pyshell#41>", line 1, in <module> for f in fibs:TypeError: iter() returned non-iterator of type 'Fibs'
在Python3.0版本及以后版本中用__next__魔法方法代替以前的next方法
0 0
- TypeError: iter() returned non-iterator of type
- TypeError: iter() returned non-iterator of type
- TypeError: iter() returned non-iterator of type 'Fibs'
- TypeError: iter() returned non-iterator of type 'xx' 从Python3开始,要用__next__
- django Error during template rendering,TypeError: __str__ returned non-string (type int)
- Django查询models对象报错:TypeError: __str__ returned non-string (type decimal.Decimal)
- django遇到TypeError: can't multiply sequence by non-int of type 'tuple'
- TypeError: can't multiply sequence by non-int of type 'float'
- __str__ returned non-string (type int)
- django报错:TypeError: __str__returned non-string (type bytes)
- Django rest framework __str__ returned non-string (type NoneType)
- cannot pass objects of non-POD type
- TypeError: object of type 'NoneType' has no len()
- TypeError: argument of type 'int' is not iterable
- TypeError: object of type 'zip' has no len()
- Django rest framework 返回错误信息 __str__ returned non-string (type NoneType)
- invalid initialization of non-const reference of type ‘int*&’ from a temporary of type ‘int*’
- 编译错误:error: invalid initialization of non-const reference of type ‘*&’ from a temporary of type
- android中getCompoundDrawables()方法,设置文本框中图片的位置
- 16.7.21
- Lamp环境下安装及使用coreseek(liunx)
- sql server 自定义函数的使用
- elasticsearch2.3.3 java client demo
- TypeError: iter() returned non-iterator of type
- javascript中函数柯里化解析
- CentOS6.5下redis3.2.1安装
- [headset]MTK平台怎样提高耳机双击检测成功率
- jquery小知识——自定义isNull
- Java 文件写入读取统计字符
- 快速幂算法
- SetForeGroundWindow
- Oracle学习记录整理笔记3-默认的管理表