Skip to content

Instantly share code, notes, and snippets.

@jok3rcito0
Created May 26, 2023 20:32
Show Gist options
  • Save jok3rcito0/ea55ecb9decba03f1ccffd08aeaca66e to your computer and use it in GitHub Desktop.
Save jok3rcito0/ea55ecb9decba03f1ccffd08aeaca66e to your computer and use it in GitHub Desktop.
Remove duplicated Items
my_list = []
def remove_duplicates(lista):
no_repeat_list = list(set(lista))
return no_repeat_list
def save_to_file(lista, filename):
with open(filename, 'w') as file:
for element in lista:
file.write(str(element) + '\n')
no_repeat_list = remove_duplicates(my_list)
save_to_file(no_repeat_list, 'lista_sin_repetidos.txt')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment