Hi everyone,
Im a python beginner so please bare with me, i have done the first few project euler but thats it,
Im trying to write a script that will search all txt, htm, html files recursively through multiple directorys for a string and will then write the whole line that that string is on to a new text file.
So far i've got to here, now im stuck,
import os
for root, dirs, files in os.walk('C:\New Folder'):
for file in [f for f in files if f.endswith(".html" or ".htm" or ".txt")]:
fh = open(file)
for line in fh:
print(line)
fh.close()
Am I on the write track? Can anyone quickly provide a sample?
Also the folders are on a network drive, can python read this?
Thanks
Roboguy