标签:style blog color io os div sp log on
assert语句:
用以检查某一条件是否为True,若该条件为False则会给出一个AssertionError。
用法:
assert type(x)=int and x>=0
如果不满足后面的expression,则会弹出
Traceback (most recent call last): File "<pyshell#7>", line 1, in <module> assert type(n)==int and n>0 AssertionError
标签:style blog color io os div sp log on
原文地址:http://www.cnblogs.com/fei-hsueh/p/3973280.html