Closed bauerj closed 7 years ago
Assume the following code:
db.put(b"key1", bytes(1)) db.put(b"key2", bytes(2)) db.put(b"key3", bytes(3)) db.put(b"key4", bytes(4)) it = db.iteritems() it = reversed(it) it.seek("key") print it.__iter__().__next__()
I would expect that this prints (b'key4', b'\x00\x00\x00\x00') but the output is (b'key1', b'\x00').
(b'key4', b'\x00\x00\x00\x00')
(b'key1', b'\x00')
Is there any way to make seek search backwards (find the last matching entry)?
I think you can try something like "key$" (lexographically some later character) to get what you're after.
Assume the following code:
I would expect that this prints
(b'key4', b'\x00\x00\x00\x00')
but the output is(b'key1', b'\x00')
.Is there any way to make seek search backwards (find the last matching entry)?