- Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathlmdb_example.py
More file actions
Latest commit
24 lines (23 loc) · 472 Bytes
/
Copy pathlmdb_example.py
File metadata and controls
24 lines (23 loc) · 472 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/false
importlmdb
withlmdb.open('t.lmdb') asenv:
withenv.begin(write=True) astxn:
foriinxrange(1000):
txn.put(str(i**5), str(i))
# Expected output:
# (0, '0')
# (1, '1')
# (32, '2')
# (243, '3')
# (1024, '4')
# (3125, '5')
# (7776, '6')
# (16807, '7')
# (32768, '8')
# (59049, '9')
withlmdb.open('t.lmdb') asenv:
withenv.begin() astxn:
foriinxrange(100000):
v=txn.get(str(i))
ifvisnotNone:
print (i, v)