Python处理子列表重复笔记

Python处理子列表重复笔记

lit=[['a','b'],['h','a'],['c','d'],['d','f'],['s','f'],['v','m']]

for i in lit:
    for j in lit:
        for x in i:
            if x in j:
                lit.remove(j)
            break

print(lit)

打印结果:

[['h', 'a'], ['d', 'f'], ['v', 'm']]

你可能感兴趣的:(Python,python,列表)