>>> 1/0 Traceback (most recent call last): File "", line 1, in ZeroDivisionError: integer division or modulo by zero >>>
raise [someException [, args [, traceback]]]
try: try_suite #进行监控的代码 except Exception[, reason]: except_suite #异常处理的代码 [except Exception2[, reson2]: except_suite2 # 处理try语句中可能发生的多种异常 [else: else_suite #try中语句执行没有异常被检测到 [finally: finally_suite #无论如何均会执行]]]
try:
try:
try_suite
except:
excetp_suite
finally:
finally_suite
try: try_suite except: excetp_suite finally: finally_suite
assert expression1, expression2
>>> a=10 >>> assert a<=10, "Error" >>> a = 11 >>> assert a<=10, "Error" Traceback (most recent call last): File "<stdin>", line 1, in <module> AssertionError: Error
if a>10: raise AssertionError("Error")
python -0 test.py
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有