
dannywebster at googlemail
May 9, 2008, 2:10 AM
Views: 129
Permalink
|
|
Grabbing previous iteration in a dict
|
|
Hello all, I have a dictionary of which i'm itervalues'ing through, and i'll be performing some logic on a particular iteration when a condition is met with trusty .startswith('foo'). I need to grab the previous iteration if this condition is met. I can do something with an extra var to hold every iteration while iterating, but this is hacky and not elegant. Is there a mechanism whereby I can just index the dict value subscripts like in an array? I could just rewind by 1 if so. Cheerz dan. -- http://mail.python.org/mailman/listinfo/python-list
|