examples/other/open_many_files.py
from __future__ import print_function

import sys

# 3 files, 2 of them are the same as this script so they exist
# the middle one does not exist
files = sys.argv[0], 'other.txt', sys.argv[0]

for f in files:
    print("before " + f)
    try:
        fh = open(f, 'r')
    except IOError:
        #except Exception as e:
        #  print(e)
        continue    # will go to next file immediately
        # pass      # will go on to the 'after' part
    print("after  " + f)
exceptions