标签: python list if-statement
在 python 中,我试图运行此代码:
blacklist = ['hello', 'man'] for word in open("text.txt"): if word not in blacklist: print(word)
在 text.txt 我有
test hello man
我希望输出为:
test
但是 - 它只返回 text.txt 的文本! 有什么问题?