Lazulitecn 2021-03-23 17:03 采纳率: 84.8%
浏览 207
已结题

Python怎么将列表A与列表B的交集从A中删除

a b c d e f 代表不定的元素

情景1:
lista = a b c d e
listb = c d f
out = a b e

情景2:
lista = a b c d e
listb = c
out = a b d e

情景3:
lista = a b c d e
listb = c d
out = a b e

情景4:
lista = c
listb = c
out =
  • 写回答

5条回答 默认 最新

  • 我不喜欢这个世界 2021-03-23 17:11
    关注
    lista = ['a','b','c','d','e']
    listb = ['c']
    s = list(set(lista)-(set(listb)))
    print(s)
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月6日