Ed Jensen wrote:

> Peter Otten <[EMAIL PROTECTED]> wrote:
> 
>>> try:
>>>     f = file('test.txt', 'r')
>>> except IOError:
>>>     print 'except'
>>> else:
>>>     print 'else'
>>> finally:
>>>     print 'finally'
> 
>> You need Python 2.5 for that to work. In older Python versions you have
>> to nest try...except...else and try...finally.
> 
> Thanks Peter.
> 
> Given the code above, can you show me what that would look like?  The
> nested version, that is.

try:
    try:
        f = file("test.txt", "r")
    except IOError:
        print "except"
    else:
        print "else"
finally:
    print "finally"

Peter

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to