Find Lines in Multiple Files

Question:

Write a python program to print only those lines in a list of files that has a particular word

Here, I am looking for a word ‘print’ in a list of python files.

Program:

Explanation:

Generator Expressions are generator version of list comprehensions. They look like list comprehensions, but returns a generator back instead of a list.

Output:

Do share your feedback in comments to help us adding more programs like this.

Checkout more Python Programs

Click here

Leave a Reply