这是我第一次把“dbm”模块作为一本书中练习的一部分来研究,我不明白为什么会出现这个错误
import dbm
db = dbm.open('chapt14/dbtest/captions', 'c')
db['cleese.png'] = 'Photo of John Cleese'
db['testeroni.png'] = 'Photo of Cohn Jleese'
for key in db:
print(key, db[key])
db.close()
Traceback (most recent call last):
File "/home/individuation/Documents/Code/ThinkPython/chapt14/dbtest/db_test.py", line 7, in <module>
for key in db:
TypeError: '_gdbm.gdbm' object is not iterable
目前没有回答
相关问题 更多 >
编程相关推荐