我正在使用Kenneth ritz优秀的记录库来连接关系数据库
rec = db.query('select * from dept')
for r in rec:
print(rec.next)
<bound method RecordCollection.next of <RecordCollection size=1 pending=True>>
<bound method RecordCollection.next of <RecordCollection size=2 pending=True>>
<bound method RecordCollection.next of <RecordCollection size=3 pending=True>>
<bound method RecordCollection.next of <RecordCollection size=4 pending=True>>
C:\Python36\Scripts\ipython3:1: DeprecationWarning: generator 'RecordCollection.__iter__' raised StopIteration
我正在尝试迭代数据库查询的结果但是在迭代之后我得到一个令人讨厌的异常任何想法
我试过这个
In [63]: for r in rec:
...: print(r)
...:
...:
...:
<Record {"deptno": 10, "dname": "ACCOUNTING", "loc": "NEW YORK"}>
<Record {"deptno": 20, "dname": "RESEARCH", "loc": "DALLAS"}>
<Record {"deptno": 30, "dname": "SALES", "loc": "CHICAGO"}>
<Record {"deptno": 40, "dname": "OPERATIONS", "loc": "BOSTON"}>
C:\Python36\Scripts\ipython3:1: DeprecationWarning: generator 'RecordCollection.__iter__' raised StopIteration
我仍然得到StopIteration警告