Created
May 26, 2023 20:32
-
-
Save jok3rcito0/ea55ecb9decba03f1ccffd08aeaca66e to your computer and use it in GitHub Desktop.
Remove duplicated Items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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