Answers for "delete duplicates in file python"

6

delete the duplicates in python

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

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

python delete duplicate lines in file

with open("file.txt", "r") as txt_file:
  new_data = list(set(txt_file))
  return new_data
Posted by: Guest on November-30-2020

Code answers related to "delete duplicates in file python"

Python Answers by Framework

Browse Popular Code Answers by Language