Python教程

LevelDB的Python开发包 py-leveldb基本使用方法的代码

本文主要是介绍LevelDB的Python开发包 py-leveldb基本使用方法的代码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

下面内容段是关于LevelDB的Python开发包 py-leveldb基本使用方法的内容,希望能对码农们有帮助。
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)

这篇关于LevelDB的Python开发包 py-leveldb基本使用方法的代码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!