2010-02-08 53 views

回答

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

或在Python 2.6及以上,e.args尋找類似PERROR(),因爲BaseException.message has been deprecated

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

我使用python 2.6,因此電子商務。參數工作正常。謝謝 – 2010-02-08 07:11:43

-2
try: 
    pass 
except Exception, err: 
    print err 
相關問題