Searching for a list of strings in a file with Python
Starriol
juanscopp at gmail.com
Mon Oct 14 01:34:43 EDT 2013
Hi guys,
I'm trying to search for several strings, which I have in a .txt file line by line, on another file.
So the idea is, take input.txt and search for each line in that file in another file, let's call it rules.txt.
So far, I've been able to do this, to search for individual strings:
[code]import re
shakes = open("output.csv", "r")
for line in shakes:
if re.match("STRING", line):
print line,[/code]
How can I change this to input the strings to be searched from another file?
So far I haven't been able to.
Thanks for the ideas.
More information about the Python-list
mailing list