1. 程式人生 > >python 斷言

python 斷言

python

斷言

>>> assert 3 < 4 #assert 斷言,當關鍵字後面條件為假的時候,程序自動崩潰並拋出AssertionError異常

>>> assert 3 > 4

Traceback (most recent call last):

File "<pyshell#8>", line 1, in <module>

assert 3 > 4

AssertionError


本文出自 “每天進步一點點” 博客,請務必保留此出處http://zuoshou.blog.51cto.com/2579903/1980719

python 斷言