python 3.3 try..catch 小例
python 3.3 try..catch 小例
[python]
s=input("input your age:")
if s=="":
raise Exception("input must not be empty.")
try:
i=int(s)
except Exception as err:
print(err)
finally:
print("Goodbye!")
s=input("input your age:")
if s=="":
raise Exception("input must not be empty.")
try:
i=int(s)
except Exception as err:
print(err)
finally:
print("Goodbye!")
运行结果:
相关内容
- 暂无相关文章
评论关闭