[Tutor] Single pass through if loop yeilds multiple results...

Magnus Lycka magnus@thinkware.se
Wed Nov 27 17:47:02 2002


At 17:11 2002-11-27 -0500, Doug.Shawhan@gecits.ge.com wrote:
>I am performing lookups with anydbm.
>...
>I will get multiple returns with the same key.

Are you sure that these are identical keys? It's
not '10l1402 ' in one case and '10l1402' in the
other, or something like that?

Maybe something like...

strangeKey = '10l1402'
for key in db.keys():
     if key.find(strangeKey) != -1:
         print repr(key)

...will be of help.


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se