Skip to content Skip to sidebar Skip to footer

I M Searching For A Specific String In Multiple ".txt" Files Using Python

I'm trying to search strings like 'a.aiq' in multiple .txt files and I want those '.aiq' results to be printed So far I have written below code. It gives no error but doesn't give

Solution 1:

str = fo.readline()
while str:     
...   
    str = fo.readline()

should be replaced by:

for str in fo:

The first question is: Is file_array correct? Use for example

for input_file in file_array:
    print input_file #add parenthesis in python 3

Post a Comment for "I M Searching For A Specific String In Multiple ".txt" Files Using Python"