Python两个列表去除相同内容

a = "ab\\as\\ef"
b = "ab\\as\\ef"

a_list = a.split("\\")
b_list = b.split("\\")

c_list = []

for i in a_list:
    if i in b_list:
        c_list.append(i)

for i in c_list:
    a_list.remove(i)
    b_list.remove(i)

print(a_list)
print(b_list)
posted @ 2021-03-05 15:59  道友请留步W  阅读(383)  评论(0编辑  收藏  举报