0

我在牛津词典中运行了一个小循环,查找并打印出定义中包含其中一个单词的任何单词search_list

但是当我使用例如列表运行它时: `['hello', 'next', 'from'] 它只在第一次运行循环。有谁知道为什么会这样?

print(search_list)
Oxford = open("oxford_dictionary.txt")
for word in search_list:
    for line in Oxford:
        if word in line: 
            print(line.split(' ', 1)[0])

Oxford.close()
4

0 回答 0