2010-02-08 14 views

Répondre

5
>>> try: 
...  0/0 
... except Exception,e: 
...  print e.message 
... 
integer division or modulo by zero 

ou en Python 2.6 et au-dessus, e.args, à cause de BaseException.message has been deprecated

>>> try: 
...  0/0 
... except Exception,e: 
...  print e.args 
... 
('integer division or modulo by zero',) 
+0

J'utilise Python 2.6, donc e. args fonctionne bien.Merci –

-2
try: 
    pass 
except Exception, err: 
    print err