py-leveldb - LevelDB的Python开发包


LGPL
Linux
Python

软件简介

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)