py-leveldb 是 Google 的 K/V 数据库 LevelDB 的 Python 客户端开发包。
import leveldb db = leveldb.LevelDB('./db') # single put db.Put('hello', 'world') print db.Get('hello') # single delete db.Delete('hello') print db.Get('hello') # multiple put/delete applied atomically, and committed to disk batch = leveldb.WriteBatch() batch.Put('hello', 'world') batch.Put('hello again', 'world') batch.Delete('hello') db.Write(batch, sync = True)