about bsddb module

cocobear cocobear.cn at gmail.com
Sun May 4 01:06:59 EDT 2008


On 5月3日, 下午7时17分, cocobear <cocobear... at gmail.com> wrote:
> How to deal with multiple databases in an file. I want to get the
> content of several databases.
>
> it's the code I wrote:
>
> [cocobear at cocobear ~]$ python
> Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
> [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.>>> importbsddb
> >>> import os
> >>> import time
>
> >>> db_file = 'native.db'
> >>> db =bsddb.db.DB()
> >>> db.open(db_file,bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
> >>> dbs = db.keys()
> >>> db.open(db_file,dbs[0],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
> >>> db.keys()
>
> ['\x01\x00\x00\x00', '\x02\x00\x00\x00', '\x03\x00\x00\x00',
> '\x04\x00\x00\x00', '\x05\x00\x00\x00']
>
> >>> db.open(db_file,dbs[1],bsddb.db.DB_UNKNOWN,bsddb.db.DB_RDONLY)
>
> the program stop here.


Anybody can help me?



More information about the Python-list mailing list