try/except with multiple files

Robert Hicks sigzero at gmail.com
Thu Jun 21 21:00:25 CEST 2007


Is it good practice to do something like:

try:
    f1 = file('file1')
    f2 = file('file2')
except:
    # catch the exception

Or do you do a try/except for each open?

Robert




More information about the Python-list mailing list