Michael, On Sat, 2012-03-24 at 15:20 -0700, Michael Lewis wrote: [...]
It is perhaps worth noting that in Python 3, the syntax has changed:
> import os, errno
> try:
>
> os.makedirs('a/b/c')
> except OSError, e:
except OSError as e :
>
> if e.errno != errno.EEXIST:
>
> raise
This "as" syntax works in 2.6 and 2.7 so is probably the syntax to use
unless you have to use very old versions of Python. I think the "as"
syntax makes it clearer that e is a variable referring to the instance
of OSError that causes the except clause to execute if it does.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Tutor maillist - [email protected] To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
