469,924 Members | 1,406 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,924 developers. It's quick & easy.

slicing a bsddb table, eg. for rec in bsddb["AArdvark":"zebra"]:print rec

#!/bin/env python
import bsddb

test=bsddb.btopen("test.tbl")
for m in "JFMATQPHSOND":
test[m]="Profit for month "+m+" $1B"

def subyear_report(record_selection):
for data in record_selection.iteritems(): print data

# I was expecting a slice of an index file to yield a
# generator so not all the records need to be read from disk....
subyear_report(test["Apr":"Sep"])

"""
I have tried a few ideas.... but is there a simple way to convert this
["Apr":"Sep"] slice of a file into a generator of the requested records?

(I tried UserDict and got a bit further...)

Any hints?

ThanX
NevilleDNZ
"""

Jul 19 '05 #1
0 882

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John D. | last post: by
reply views Thread by Jane Austine | last post: by
3 posts views Thread by Harry Pehkonen | last post: by
4 posts views Thread by Michele Simionato | last post: by
reply views Thread by Barry | last post: by
2 posts views Thread by lazy | last post: by
1 post views Thread by BjornT | last post: by
2 posts views Thread by cocobear | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.