Skip to content

Instantly share code, notes, and snippets.

@GiorgioRegni
Created January 14, 2017 01:31
Show Gist options
  • Save GiorgioRegni/7f66e2c41a9ff1895da291ccea56b69b to your computer and use it in GitHub Desktop.
Save GiorgioRegni/7f66e2c41a9ff1895da291ccea56b69b to your computer and use it in GitHub Desktop.
#!/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