import shelve def dumpshelve(name): db = shelve.open(name) for key in db.keys(): print "%s => %s" % (key, db[key]) if __name__ == '__main__': dumpshelve('testdb')