search

Home  >  Q&A  >  body text

python语言怎么删除列表中重复的记录?

python语言怎么删除列表中重复的记录?

末日的春天末日的春天2823 days ago1271

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-10-01 00:45:38

    How to delete duplicate records in the list in python language? -PHP Chinese website Q&A-How to delete duplicate records in the list in python language? -PHP Chinese website Q&A

    Let’s take a look and learn.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-03-09 09:10:09

    具体代码如下,供参考:

    def removeListDuplicates(seq):
      seen = set()
      seen_add = seen.add
      return [ x for x in seq if x not in seen and not seen_add(x) ]


    reply
    0
  • Cancelreply