更新时间:2023-02-10 14:35:54
you have to split all by ,
al the elements from your sublists than you can use the solution you already have found:
st = [{i for e in l for i in e.split(',') } for l in list1]
[l for l, s in zip(list1, st) if not any(s < other for other in st)]
输出:
[['A,B,C,D', 'Y', 'hello'],
['A,B,C', 'Z', 'hello'],
['H,I,J,K,L', 'Z', 'hello'],
['A,D,C,B', 'Z', 'hi']]