欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2, C++/F#/Lisp
Python bsddb
来自开放百科 - 灰狐
Hash, BTree and Record Objects
http://docs.huihoo.com/python/2.5/lib/bsddb-objects.html
Example
>>> import bsddb >>> db = bsddb.btopen('/tmp/spam.db', 'c') // create db in c:\tmp\spam.db or /tmp/spam.db >>> for i in range(10): db['%d'%i] = '%d'% (i*i) ... >>> db['3'] '9' >>> db.keys() ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] >>> db.first() ('0', '0') >>> db.next() ('1', '1') >>> db.last() ('9', '81') >>> db.set_location('2') ('2', '4') >>> db.previous() ('1', '1') >>> for k, v in db.iteritems(): ... print k, v 0 0 1 1 2 4 3 9 4 16 5 25 6 36 7 49 8 64 9 81 >>> '8' in db True >>> db.sync() 0
>>> db.clear() >>> db.sync() >>> db.keys() [] >>> for i in range(100000): db['%d'%i] = '%d'% (i*i) // 100,000 records, 5,040 KB size
分享您的观点