I just want to list the filename matching the multiline string
n=Mike
s=Tyson
Below code works, but is there a more pythonic way, like a grep instead of reading the content and iterating line by line?
import glob
>>> for filepath in glob.iglob('**/*.txt', recursive=True):
     with open(filepath) as file:
        content = file.read()
        match = re.search('n=Mike\ns=Tyson', content)
        if match:
            print(filepath)
 
    