python leveldb 文档
标签(空格分隔): python leveldb
import leveldb
db = leveldb.LevelDB('./db')
db.Put('hello', 'world')
print db.Get('hello')
db.Delete('hello')
print db.Get('hello')
batch = leveldb.WriteBatch()
batch.Put('hello', 'world')
batch.Put('hello again', 'world')
batch.Delete('hello')
db.Write(batch, sync = True)
class LevelDB(builtin.object) | LevelDB(filename, **kwargs) -> leveldb object |
| Open a LevelDB database, from the given directory. |
| Only the parameter filename is mandatory. |
| filename the database directory | create_if_missing (default: True) if True, creates a new database if none exists | error_if_exists (default: False) if True, raises and error if the database already exists | paranoid_checks (default: False) if True, raises an error as soon as an internal corruption is detected | block_cache_size (default: 8 * (2 << 20)) maximum allowed size for the block cache in bytes | write_buffer_size (default 2 * (2 << 20))
| block_size (default: 4096) unit of transfer for the block cache in bytes | max_open_files: (default: 1000) | block_restart_interval
|
| Snappy compression is used, if available. |
| Some methods support the following parameters, having these semantics: |
| verify_checksum: iff True, the operation will check for checksum mismatches | fill_cache: iff True, the operation will fill the cache with the data read | sync: iff True, the operation will be guaranteed to sync the operation to disk |
| Methods supported are: |
| Get(key, verify_checksums = False, fill_cache = True): get value, raises KeyError if key not found |
| key: the query key |
| Put(key, value, sync = False): put key/value pair |
| key: the key | value: the value |
| Delete(key, sync = False): delete key/value pair, raises no error kf key not found |
| key: the key |
| Write(write_batch, sync = False): apply multiple put/delete operations atomatically |
| write_batch: the WriteBatch object holding the operations |
| RangeIter(key_from = None, key_to = None, include_value = True, verify_checksums = False, fill_cache = True): return iterator |
| key_from: if not None: defines lower bound (inclusive) for iterator | key_to: if not None: defined upper bound (inclusive) for iterator | include_value: if True, iterator returns key/value 2-tuples, otherwise, just keys |
| GetStats(): get a string of runtime information
class WriteBatch(builtin.object) | WriteBatch() -> write batch object |
| Create an object, which can hold a list of database operations, which | can be applied atomically. |
| Methods supported are: |
| Put(key, value): add put operation to batch |
| key: the key | value: the value |
| Delete(key): add delete operation to batch |
| key: the key |
'CompactRange',
'CreateSnapshot',
'Delete',
'Get',
'GetStats',
'Put',
'RangeIter',//通过Key进行切片处理,因为所有的存储都是有序的
'Write',
'__class__',
'__delattr__',
'__doc__',
'__format__',
'__getattribute__',
'__hash__',
'__init__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__']
python leveldb 文档的更多相关文章
- 如何在命令行模式下查看Python帮助文档---dir、help、__doc__
如何在命令行模式下查看Python帮助文档---dir.help.__doc__ 1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...
- python统计文档中词频
python统计文档中词频的小程序 python版本2.7 效果如下: 程序如下,测试文件与完整程序在我的github中 #统计空格数与单词数 本函数只返回了空格数 需要的可以自己返回多个值 def ...
- 在命令行模式下查看Python帮助文档---dir、help、__doc__
在命令行模式下查看Python帮助文档---dir.help.__doc__ 1.dir函数式可以查看对象的属性,使用方法很简单,举str类型为例,在Python命令窗口输入 dir(str) 即 ...
- Python帮助文档中Iteration iterator iterable 的理解
iteration这个单词,是循环,迭代的意思.也就是说,一次又一次地重复做某件事,叫做iteration.所以很多语言里面,循环的循环变量叫i,就是因为这个iteration. iteration指 ...
- 使用Python对文档单词进行计数
做hacker.org上面的题目时,遇到了一个题目需要对RFC3280种长度为9的单词进行计数,并找出这些单词中出现次数最多的那个:Didactic Byte RFC3280文档有7000多行,靠人工 ...
- 三言两语聊Python模块–文档测试模块doctest
doctest是属于测试模块里的一种,对注释文档里的示例进行检测. 给出一个例子: splitter.pydef split(line, types=None, delimiter=None): &q ...
- python 本地文档查看
本地安装Python文档本地查看,在命令行中运行: python -m pydoc -p 1234 在浏览器中访问如下链接,就可以访问到本地文档: http://localhost:1234/ 本地文 ...
- 使用Sphinx生成本地的Python帮助文档
第一步:安装Sphinx 首先我们需要安装Sphinx,如果已经安装了Anaconda,那么只需要使用如下命令即可安装,关于其中的参数 -c anaconda,可以在链接[1]中查看: conda i ...
- Python asyncio文档阅读摘要
文档地址:https://docs.python.org/3/library/asyncio.html 文档第一句话说得很明白,asyncio是单线程并发,这种event loop架构是很多新型异步并 ...
随机推荐
- php auto_prepend_file和auto_append_file的妙用
这是一个鲜为人知的设置! auto_prepend_file 和 auto_append_file 是在php.ini中进行配置的2个参数,auto_prepend_file 表示在php程序加载第一 ...
- Java反射机制--是什么,为什么,怎么用。
往往当我们面对一项新的知识时,我们往往需要知道三个方面,它是什么,它能做什么,它比原有知识强在哪里,我们该怎么使用它.当你能够解决这些问题时,便意味着你已经对这项知识入门了. 一.是什么 Java R ...
- 原生 JS 实现扫雷 (分析+代码实现)
阅读这篇文章需要掌握的基础知识:Html5.CSS.JavaScript 在线Demo:查看 扫雷规则 在写扫雷之前,我们先了解下它的游戏规则 ● 扫雷是一个矩阵,地雷随机分布在方格上. ● 方格上的 ...
- 简易坦克大战python版
#! /usr/bin/env python # -*- coding:utf8 -*- ''' *author:wasua *purpose:学习python语言,其中的类以及pygame应用 ...
- Linux 学习第五天
一.重定向.管道符.通配符 1.重定向.管道符使用 重定向: 命令文件 管道符: 命令A:命令B (管道符 | 别称 “任意门”) 二.常用命令 1.ls /etc | wc -l (查看目录 ...
- sass的嵌套
sass的嵌套包括两种: 1.选择器的嵌套.(最常用到) 指的是在一个选择器中嵌套另一个选择器来实现继承,从而增强了sass文件的结构性和可读性. 在选择器嵌套中,可以使用&表示父元素选择器 ...
- Cannot send session cache limiter - headers already sent问题
在php.ini中将“always_populate_raw_post_data ”设置为“-1”,并重启
- PHP文档生成器(PHPDoc)的基本用法
目录 PHP文档生成器(PHPDoc)的基本用法 PHPDoc概述 安装 PHPDoc注释规范 页面级别的注释 代码级别的注释 生成API文档 额外软件 PHP文档生成器(PHPDoc)的基本用法 P ...
- 【数据结构】循环链表&&双向链表详解和代码实例
喜欢的话可以扫码关注我们的公众号哦,更多精彩尽在微信公众号[程序猿声] 01 循环链表 1.1 什么是循环链表? 前面介绍了单链表,相信大家还记得相关的概念.其实循环链表跟单链表也没有差别很多,只是在 ...
- [Codefroces401D]Roman and Numbers(状压+数位DP)
题意:给定一个数,求将该数重新排列后mod m==0的方案数 重新排列就考虑到用到哪些数,以及此时mod m的值 于是dp[i][j]表示状态i中mod m==j的方案数 注意:转移的时候只要找到一种 ...