Again apologies for been noob here: Trying below code for searching multiple strings read from keywords and search in f
and printing the line.
It works if I have on
keywords = input("Please Enter keywords path as c:/example/ \n :")
keys = open((keywords), "r").readline()
keys = keys.split(',') # separates key strings
with open("c:/saad/saad.txt") as f:
for line in f:
for key in keys:
if key.strip() in line:
print(line)
You are reading the line in as one string. You need to make a list of each comma separated string. Then test each key for each line (removing whitespace around the key)
This is assuming your keyword file is something like: aa is good, bb is good, spam, eggs