# 普通表达式

list = ["你好","世界","", "","在这里","遇见美好"]

for i in list:
    print(i, bool(i))

# 普通表达式

list = ["你好","世界","", "","在这里","遇见美好"]
for i in list:
    if i:
        print(i, bool(i))

# 列表表达式

list = ["你好","世界","", "","在这里","遇见美好"]

result = [i for i in list if i]
print(result)


↙↙↙阅读原文可查看相关链接,并与作者交流