Answers for "how to remove dublicates form a list in python without shuffing it"

6

how to make python remove the duplicates in list

mylist = ["a", "b", "a", "c", "c"]
mylist = list(dict.fromkeys(mylist))

  print(mylist)
Posted by: Guest on May-19-2020
0

python remove all double elements from list

seen = {}
new_list = [seen.setdefault(x, x) for x in my_list if x not in seen]
Posted by: Guest on October-02-2021

Code answers related to "how to remove dublicates form a list in python without shuffing it"

Python Answers by Framework

Browse Popular Code Answers by Language