作者热门文章
- mongodb - 在 MongoDB mapreduce 中,如何展平值对象?
- javascript - 对象传播与 Object.assign
- html - 输入类型 ="submit"Vs 按钮标签它们可以互换吗?
- sql - 使用 MongoDB 而不是 MS SQL Server 的优缺点
我正在使用的 API 可以返回空的 []
列表。
以下条件语句未按预期工作:
if myList is not None: #not working
pass
if myList is not []: #not working
pass
什么会起作用?
最佳答案
if not myList:
print "Nothing here"
关于python - 如何在 Python 中检查列表是否为空?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1725517/
我是一名优秀的程序员,十分优秀!