'''
shelve Ä£¿éÊ¹ÓÃÊý¾Ý¿âÇý¶¯ÊµÏÖÁË×Öµä¶ÔÏóµÄ³Ö¾Ã±£´æ.
shelve ¶ÔÏóÊ¹ÓÃ×Ö·û´®×÷Îª¼ü, µ«Öµ¿ÉÒÔÊÇÈÎÒâÀàÐÍ, ËùÓÐ¿ÉÒÔ±» pickle Ä£¿é´¦ÀíµÄ¶ÔÏó¶¼¿ÉÒÔ×÷ÎªËüµÄÖµ.
Èç ÏÂÀý ËùÊ¾.
'''

import shelve

db = shelve.open("database", "c")
db["one"] = 1
db["two"] = 2
db["three"] = 3
db.close()

db = shelve.open("database", "r")

for key in db.keys():
    print repr(key), repr(db[key])