I need to search through a directory of text files for a string. Here is a short program I made in the past to search through a single text file for a line of text.
How can I modify the code to search through a directory of files that have different filenames, but the same extension? fname = raw_input("Enter file name: ") #"*.txt" fh = open(fname) lst = list() biglst=[] for line in fh: line=line.rstrip() line=line.split() biglst+=line final=[] for out in biglst: if out not in final: final.append(out) final.sort() print (final) -- https://mail.python.org/mailman/listinfo/python-list