exceptions and items in a list
vincent at visualtrans.de
Mon Jan 10 16:10:38 EST 2005
> If I have a Python list that I'm iterating over and one of the objects
> in the list raises an exception and I have code like this:
> do something to object in list
> except Exception:
> Does the code just skip the bad object and continue with the other
> objects in the list, or does it stop?
Fire up a shell and try:
>>> seq = ["1", "2", "a", "4", "5", 6.0]
>>> for elem in seq:
... print int(elem)
... except ValueError:
and see what happens...
More information about the Python-list