python 3.3 try..catch 小例

发布时间:2017-09-11 11:39:54
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!")


运行结果:



,可视化专题,采集软件

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:武汉网站制作 http://wuhan.666rj.com