[EMAIL PROTECTED] wrote: > On Jun 21, 9:00 pm, Robert Hicks <[EMAIL PROTECTED]> wrote: >> Is it good practice to do something like: >> >> try: >> f1 = file('file1') >> f2 = file('file2') >> except: >> # catch the exception > > If what you want is to make sure that resources will be released, you > can use a try/finally block or (Python 2.5) a with block.
You could do something like this: files = [] try: for name in ['abc.txt', 'def.txt', 'ghi.txt']: files.append(open(name)) a, b, c = files <code using the three files> finally: while files: files.pop().close() --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list