How to check if an item exist in a nested list

Miles semanticist at
Fri Jul 20 06:52:55 CEST 2007

Arash Arfaee wrote:
> is there any way to check if "IndexError: list index out of
> range" happened or going to happen and stop program from terminating?

Use a try/except block to catch the IndexError

except IndexError:

More information about the Python-list mailing list