shelve

Michael W. Ryan mryan at netaxs.com
Mon Dec 20 10:04:34 EST 1999


On Mon, 20 Dec 1999 15:11:34 +0100, Anders M Eriksson
<anders.eriksson at morateknikutveckling.se> wrote:
>How do you print out (on screen) all the 'records' in a shelve?

The key thing to remember (no pun intended, honest) is that a shelve
behaves just like a dictionary.

import shelve

s = shelve.open('myshelve')
recs = s.keys()
for r in recs:
    print s[r]
s.close()

-- 
Michael W. Ryan, MCP, MCT     | OTAKON 2000
mryan at netaxs.com              | Convention of Otaku Generation
http://www.netaxs.com/~mryan/ | http://www.otakon.com/

PGP fingerprint: 7B E5 75 7F 24 EE 19 35  A5 DF C3 45 27 B5 DB DF
PGP public key available by fingering mryan at unix.netaxs.com (use -l opt)



More information about the Python-list mailing list