这是一个创建于 4255 天前的主题,其中的信息可能已经有所发展或是发生改变。
请教一个小问题
c.execute("SELECT local_code FROM db WHERE priority LIKE ?", (1,))
records = c.fetchall
我通过fetchall拿到了如下这个对象
<built-in method fetchall of sqlite3.Cursor object at 0x02C5E6A0>
但在view里面遍历打算将其显示出来的时候报错被告知
%for row in records:
<p>row</p>
%end
%for row in records:
TypeError: 'builtin_function_or_method' object is not iterable
2 条回复 • 1970-01-01 08:00:00 +08:00
|
|
1
best1a 2013-02-03 10:39:48 +08:00 1
- -都说records是一个方法对象了,回去检查下,发现是不是少了点什么呢
|
|
|
2
tangyuan 2013-02-03 10:48:40 +08:00
原来少写了个()...fetchall instead of fetchall() 晕死...感谢best1a
|