#!/usr/bin/env python # -*- coding: ISO8859-1 -*- # psf: ta=4, -*-Python-*-, vi: set et ts=4: # # file: slow_shelve.py # date: 28.11.2003 15:52:39 Uhr CET # Copyright © 2003 Haufe Mediengruppe import cPickle import shelve import sys def test(shelf): try: idx_dict = cPickle.load (open (shelf, "rb")) except: idx_dict = shelve.open (shelf, "r") for id in ( "HI412695", "HI412275", "HI958722", "HI154059", "HI66607", "HI421604", "HI421255", "HI420276", "HI416518", "HI424314", "HI415414", "HI415296", "HI414938", "HI414135", "HI61037", "HI414005", "HI72546", "HI72055", "HI413350", "HI70665" ): if idx_dict != None and idx_dict.has_key (id): print "id", id, "found" else: print "id", id, "not found" if "__main__" == __name__: import sys if len(sys.argv): test (sys.argv[1]) else: print >>sys.stderr, "Usage: %s shelf-or-dict" % sys.argv[0]