Created
January 14, 2017 01:31
-
-
Save GiorgioRegni/7f66e2c41a9ff1895da291ccea56b69b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import leveldb | |
import json | |
import collections | |
if len(sys.argv) != 3: | |
print 'usage: script db bseq' | |
sys.exit(1) | |
db = leveldb.LevelDB(sys.argv[1]) | |
idx =int( sys.argv[2])-1 | |
for k in range(idx*10000+1,(idx+1)*10000+1): | |
entry = collections.OrderedDict() | |
key = str(k).zfill(16) | |
entry["key"] = key | |
entry["value"] = db.Get(key) | |
print json.dumps(entry,separators=(',', ':')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment