fei-hsueh

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

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-01-15
  • 2021-12-02
  • 2021-12-13
  • 2021-10-20
  • 2022-01-04
  • 2021-12-13
猜你喜欢
  • 2022-01-12
  • 2021-12-28
  • 2021-12-13
  • 2022-01-22
相关资源
相似解决方案