L
Laszlo Zsolt Nagy
Hi All,
This is from the documentation of the dbhash module:
Returns the key next key/value pair in a database traversal. The
following code prints every key in the database |db|, without having
to create a list in memory that contains them all:
print db.first()
for i in xrange(1, len(db)):
print db.next()
Apparently, it is different for gdbm:
k = db.firstkey()
while k != None:
print k
k = db.nextkey(k)
I think both of them is outdated. This should be:
for key,value in db.iteritems():
print key,value
Is this the good place to post?
Les
This is from the documentation of the dbhash module:
Returns the key next key/value pair in a database traversal. The
following code prints every key in the database |db|, without having
to create a list in memory that contains them all:
print db.first()
for i in xrange(1, len(db)):
print db.next()
Apparently, it is different for gdbm:
k = db.firstkey()
while k != None:
print k
k = db.nextkey(k)
I think both of them is outdated. This should be:
for key,value in db.iteritems():
print key,value
Is this the good place to post?
Les