Removing duplicate lines

Asked

Viewed 388 times

0

I’m developing my TCC,

My TCC, it searches emails in google collection, makes bulk sending etc,

I’m having a problem, In this search for emails he collects repeated emails and invalid emails, then I’m performing an email separator, I would like help, I’ve performed the provider checker, but I’m not able to remove 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 on my list you have emails like this:

he should just return like this:

But I can’t make it through.

1 answer

1

  • Have you edited my greeting? It cannot be cordial?

  • 1

    I know this may sound strange, but it is customary to remove greetings, learn more at https://pt.meta.stackoverflow.com/a/851/112052

Browser other questions tagged

You are not signed in. Login or sign up in order to post.