Skip to content

Commit

Permalink
Merge pull request #1 from avelino/master
Browse files Browse the repository at this point in the history
Fix markdom syntax on README file
  • Loading branch information
arnimarj committed Jun 23, 2014
2 parents 6832cac + c9437d6 commit 1ca325d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 42 deletions.
42 changes: 0 additions & 42 deletions README

This file was deleted.

46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# py-leveldb

Python bindings for [LevelDB](http://code.google.com/p/leveldb/)

author: Arni Mar Jonsson (arnimarj@gmail.com)


## Build Instructions

First of all, you need to build the included leveldb library:

$ ./compile_leveldb.sh

Then, the extension itself:

$ python setup.py build

And, optionally, install it:

$ sudo python setup.py install


## Example Usage

>>> import leveldb
>>> db = leveldb.LevelDB('./db')
>>> db.Put('hello', 'world')
>>> print db.Get('hello')
world
>>> db.Delete('hello')
>>> db.Get('hello')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError
>>> for i in xrange(10):
... db.Put(str(i), 'string_%s' % i)
...
>>> print list(db.RangeIter(key_from = '2', key_to = '5'))
[('2', 'string_2'), ('3', 'string_3'), ('4', 'string_4'), ('5', 'string_5')]
>>> batch = leveldb.WriteBatch()
>>> for i in xrange(1000):
... db.Put(str(i), 'string_%s' % i)
...
>>> db.Write(batch, sync = True)
>>>

0 comments on commit 1ca325d

Please sign in to comment.