-1
나는 두 개의 텍스트 파일 dictionary.txt file_dictionary 및 output.txt file_output을 가지고 있습니다.이 파일들에는 dance, sanct 및 test의 세 가지 공통 단어가 있지만 두 단어를 비교할 때 반환되는 단어는 없습니다. 두 파일 :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)
내가 잘못했는지 확인할 수 없습니다. 도움주세요!