I needed a non-destructive method so popitem was not a viable option, but I was able to use juans suggestion of using the firstkey() and nextkey() methods but with gdb. However although I can iterate through the list beautifully now I am getting some wierd behaviour which is throwing me. If I run the following code: x = db.firstkey() while x != None: if db[x] < 2: del db[x] x = db.nextkey[x] I get the following exception: Traceback (innermost last): File "test.py", line 28, in ? findEligible(filename+'.dat', Dict) File "motif.py", line 252, in findEligible del motiflist[x] File "/usr/lib/python1.5/shelve.py", line 74, in __delitem__ del self.dict[key] KeyError: CACTG_GCGCC_TATAG Which seems wierd to me, the key is obviously there cos I have just extracted it using firstkey() and nextkey(). Just to check instead of the line: del db[x] I tried print db[x] and that doesn't generate a keyError. Why should del db[x] give me a keyError? Blobby
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4