检查 python 中是否存在列表或字典的最简单方法是什么?
我正在使用以下内容,但这不起作用:
if len(list) == 0:
print "Im not here"
谢谢,
最佳答案
对于列表:
if a_list:
print "I'm not here"
对于听写也是如此:
if a_dict:
print "I'm not here"
关于python - 如何检查列表是否存在于 Python 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11556234/