【发布时间】:2017-09-28 15:40:19
【问题描述】:
我有一个包含多个字符串的数组。我需要搜索文件以查看文件中的任何行是否与数组中的任何字符串匹配并打印文件中匹配的所有行
这是我目前所拥有的,但我的 python 语法/逻辑有点偏离
under30=[] is the array of multiple strings i want to match against the file
with open("list.txt") as f2:
for line in f2:
if under30() in line:
print line
【问题讨论】: