Two ways to de duplicate python lists

  • 2020-04-02 13:23:21
  • OfStack


# The first kind of 
def delRepeat(liebiao):
 for x in liebiao:
  while liebiao.count(x)>1:
   del liebiao[liebiao.index(x)]
 return liebiao

# The second,   You can't keep the order 
liebiao=set(liebiao)


Related articles: