問題はありますか :
import time
import dumbdbm
db = dumbdbm.open('db.db', 'c')
# modify the persistent dict / "DB" here
db['foo'] = 'bar'
db.sync()
while True:
# doing other things, sometimes modifying the db + syncing with .sync()
time.sleep(1)
スリープ時間中にCTRL+でプログラムを中断するには、つまり、適切に閉じられませんか?Cdumbdbm
dumpdbm.sync ()はデータの安全性を保証するのに十分ですか、それとも.close()
絶対に必須ですか?