On 27-Jun-10 10:12, Adam Bark wrote:
On 27 June 2010 17:47, Payal <payal-pyt...@scriptkitchen.com

    c. What is the correct Python of writing,
    except  as e: print 'Msg : ' , e        # Capturing all exceptions

Since exceptions are (should be?) subclasses of Exception, you can do:

except Exception as e:

I think the 'as' syntax is only available in Python 3.x

It's in Python 2 as well. At least I see it in 2.6.4, probably earlier too (but I'm not sure ATM how early it showed up).

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to