異常處理——python經(jīng)典實(shí)例
提問(wèn)人:楊紫紅發(fā)布時(shí)間:2020-11-26
#! /usr/bin/python
s=input("Input your age:")
if s =="":
raise Exception("Input must no be empty.")
try:
i=int(s)
except Exception as err:
print(err)
finally: # Clean up action
print("Goodbye!")
s=input("Input your age:")
if s =="":
raise Exception("Input must no be empty.")
try:
i=int(s)
except Exception as err:
print(err)
finally: # Clean up action
print("Goodbye!")
繼續(xù)查找其他問(wèn)題的答案?
相關(guān)視頻回答
點(diǎn)擊加載更多評(píng)論>>