>>> assert True# 条件为 true 正常执行
>>> assert False
# 条件为 false 触发异常
Traceback
(most recent call last
):
File
"<stdin>" ,line
1 , in <module
>AssertionError
>>> assert 1 == 1
# 条件为 true 正常执行
>>> assert 1 == 2
# 条件为 false 触发异常
Traceback
(most recent call last
):
File
"<stdin>" ,line
1 , in <module
>AssertionError
>>> assert 1 == 2 , '1 不等于 2'
Traceback
(most recent call last
):
File
"<stdin>" ,line
1 , in <module
>AssertionError
:
1不等于
2>>>
版权声明:
本文来源网络,所有图片文章版权属于原作者,如有侵权,联系删除。
本文网址:https://www.mushiming.com/mjsbk/12040.html