Python assert 用法
来源:互联网 发布:网络赌托该不该举报 编辑:程序博客网 时间:2024/06/12 00:29
Python中assert用来判断语句的真假,如果为假的话将触发AssertionError错误
python help document的解释:
Assert statements are a convenient way to insert debugging assertions into a program:
例:
>>> a = 3
>>> assert a ==3
>>> a = 2
>>> assert a ==3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AssertionError
例2:
0 0
- python assert用法
- python assert用法
- Python语言assert用法
- python 断言assert用法
- Python 断言assert用法
- Python assert 用法
- python assert用法
- Python-assert的用法
- Python进阶---python assert用法
- [Python]断言assert的用法
- Python中assert的用法
- python assert 断言基本用法
- python assert断言的用法
- Python零碎知识(11):assert用法
- Python 3 小知识 assert用法
- Python基础学习篇—assert用法
- Python中assert函数的用法小结
- python assert 断言详细用法格式
- Java迭代 : Iterator和Iterable接口
- android基础学习2————Activity入门
- 机器学习——深度学习(Deep Learning)
- 初识FreeMarker
- hdu 2098 分拆素数和
- Python assert 用法
- 机试指南
- php面试题汇总二(基础篇附答案)
- 字典压缩编码器
- 无监督特征学习——Unsupervised feature learning and deep learning
- OpenGL ES 介绍
- C++远征之封装篇——对象数组,对象成员
- Linux中设置服务自启动的三种方式
- 未来的人工智能交互技术或许是这样的