-1
dictionary.txt file_dictionaryとoutput.txt file_outputという2つのテキストファイルがあります。これらのファイルにはdance、sanct、testの3つの一般的な単語がありますが、 2つのファイル:2つのテキストファイルに共通の単語を印刷する
with open('output.txt') as words_file:
with open('dictionary.txt') as dict_file:
all_strings = set(map(str.strip, dict_file))
words = set(map(str.strip, words_file))
for word in all_strings.intersection(words):
print(word)
私は間違ったことを得ることができません。助けてください!