Removing duplicate rows
I'm developing my CBT,
My TCC, it searches emails on Google collects, does bulk sending etc,
I'm having a problem, In this email search it collects repeated emails and invalid emails, alas I am performing an email separator, I would like help, I have already performed the provider checker, but I am not able to the same remove the duplicate emails,
The code is like this:
print ("\nBUNITO\n")
palavra = input("Digite o provedor:")
arq = open('arquivo.txt','r')
contador = 0
for linha in arq:
linha = linha.rstrip()
if palavra in linha:
contador = contador +1
print(linha)
print ("\nForam Retornados", contador, "emails")
arq.close()
If my list has emails like this:
It should just return like this:
But I'm not able to accomplish this.
0
Author: Allan Petersen, 2019-04-19
1 answers
You can do like this:
lista_duplicada = ['[email protected]', '[email protected]', '[email protected]']
lista_unica = list(set(lista_duplicada))
print(lista_unica)
# ['[email protected]', '[email protected]']
1
Author: Octávio Santana, 2019-04-19 22:08:16