Python 3.x 在python 3中仅打印列表中不匹配的内容

Python 3.x 在python 3中仅打印列表中不匹配的内容,python-3.x,Python 3.x,我需要一些帮助。我有一个这样的清单: bag = [['Empty'], ['Misc'], ['Empty'], ['Empty'], ['Empty'],] for el != ['Empty'] in bag: print (el) 我只想打印不同的['Vide']列表。但不使用其他列表值。所以我试过这样的方法: bag = [['Empty'], ['Misc'], ['Empty'], ['Empty'], ['Empty'],] for el != ['Empty']

我需要一些帮助。我有一个这样的清单:

bag = [['Empty'], ['Misc'], ['Empty'], ['Empty'], ['Empty'],]
for el != ['Empty'] in bag:
    print (el)
我只想打印不同的
['Vide']
列表。但不使用其他列表值。所以我试过这样的方法:

bag = [['Empty'], ['Misc'], ['Empty'], ['Empty'], ['Empty'],]
for el != ['Empty'] in bag:
    print (el)

但什么都不管用。在这个网站上有很多匹配或使用已知值的例子。。。但我找不到解决我的问题的办法


你能帮我吗?

我不知道你不使用其他列表值是什么意思,但你可以这样做:

bag = [['Empty'], ['Misc'], ['Vide'], ['Empty'], ['Empty'], ['Empty']]

for ls in bag:
    if ls != ['Vide']:
        print(ls)

是的,就是这样。奇怪的是,我想我已经尝试过了这种方法不起作用。。。非常感谢。