Python中assert用来判断语句的真假,如果为假的话将触发AssertionError错误
如:
>>> a = 23
>>> a
23
>>> assert a == 23
>>> a -=1
>>> a
22
>>> assert a == 23
Traceback (most recent call last):
File "", line 1, in
assert a ==
23
AssertionError
>>>
原文:http://www.cnblogs.com/jane0912/p/4167737.html