Ignore exception in Python

hrishikeshp19 picture hrishikeshp19 · Feb 11, 2012 · Viewed 17.8k times · Source

I have try-except block in python, and I want to do nothing when exception occurs. My code is as follows:

for i in range(len(grid)):
    for j in range(len(grid[i])):
        try:
            count = count > int(grid[i][j]) ? count : int(grid[i][j])
        except:
            //Do nothing here

How do I do nothing when exception is caught.

Thanks.

Answer

snim2 picture snim2 · Feb 11, 2012

pass is the keyword you are looking for.