python读取leveldb数据

发布时间:2019-09-22 07:41:01编辑:auto阅读(2539)

    import sys
    import leveldb
    def read_data():
    	if len(sys.argv) < 2:
    		print "pls input leveldb dir"
    		return -1
    	db = leveldb.LevelDB(sys.argv[1])
    	for k in db.RangeIter(include_value = False):
    			print db.Get(k)
    if __name__ == '__main__':
    	read_data()
    	print "read end"
    

关键字