我正在使用的 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/