rbt wrote:
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:

try:
    do something to object in list
except Exception:
    pass

Does the code just skip the bad object and continue with the other objects in the list, or does it stop?

Thanks

Fire up a shell and try:

>>> seq = ["1", "2", "a", "4", "5", 6.0]
>>> for elem in seq:
...     try:
...        print int(elem)
...     except ValueError:
...        pass


and see what happens...

--
Vincent Wehren
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to