What is the difference between 'except IOError as e:' and 'except IOError, e:'

Xavier Ho contact at xavierho.com
Wed Nov 18 03:33:43 CET 2009

On Wed, Nov 18, 2009 at 12:28 PM, Peng Yu <pengyu.ut at gmail.com> wrote:

> I don't see any different between the following code in terms of
> output. Are they exactly the same ('as' v.s. ',')?

Yes, they're exactly the same. However, the syntax with "as" is newer,
introducted in Python 3.x, and eventually backported to 2.6. If you have
used Python 2.5, only the comma syntax would work.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20091118/dbda5997/attachment.html>

More information about the Python-list mailing list