断言的使用

>>> x = 1
>>> y = 2
>>> assert x == y, "not equals"

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    assert x == y, "not equals"
AssertionError: not equals
>>> 
原文地址:https://www.cnblogs.com/themost/p/9540305.html