Created
May 11, 2016 00:51
-
-
Save joffilyfe/252788d30bd963eadfb8c8fa8958a28a to your computer and use it in GitHub Desktop.
Comparando palavras em arquivos
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
dicionario = open('dicionario.txt', 'r') | |
site = open('site.txt', 'r') | |
resultado = open('resultado.txt', 'w') | |
site_words = [] | |
dicionario_words = [] | |
for word in site: | |
site_words.append(word) | |
else: | |
site.close() | |
for word in dicionario: | |
dicionario_words.append(word) | |
else: | |
dicionario.close() | |
for word in site_words: | |
if word in dicionario_words: | |
resultado.write("{}".format(word)) | |
else: | |
resultado.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment