close
Python 在 try except 之後,如果想要直接把 exception 印出來,可以使用下述的方式:
sentence = raw_input()
try:
print(sentence)
except Exception as e:
print(e)
|
這樣就可以印出 exception了,打完收工~
Reference:
1. https://stackoverflow.com/questions/1483429/how-to-print-an-error-in-python
全站熱搜