python
LWQ0809
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
assert
assertEqual:如两个值相等,则pass assertNotEqual:如两个值不相等,则pass 使用方法:assertEqual(first,second,msg)其中first与second进行比较,如果相等则通过;msg为失败时打印的信息,选填;断言assertNotEqual反着用就可以了。 assertTrue:判断bool值为True,则pass原创 2018-01-31 10:43:03 · 439 阅读 · 0 评论 -
`if not x:` 和`if x is not None:`和`if not x is None:`
主要有三种判断变量是否为None: `if x is None`; `if not x:`; `if not x is None`(`if not (x is None)`) 。 在python中 None, False, 空字符串"", 0, 空列表[], 空字典{}, 空元组()都相当于False ,即: [python] view p原创 2018-01-31 12:53:23 · 882 阅读 · 0 评论
分享