def select_lines_from_file(filename, query): pass
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 10RQ
Related questions
Question
![### QUESTION FIVE ###
def select_lines_from_file(filename, query):
pass](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc06466e0-b6af-451e-ad3a-a7add978ace4%2F4f3c7243-224d-4a07-979f-731dd7162c7a%2Fsra33wo_processed.png&w=3840&q=75)
Transcribed Image Text:### QUESTION FIVE ###
def select_lines_from_file(filename, query):
pass
![5. select_lines_from_file
In this function, we will open a file for reading, look at each line in the file, and return a list of the lines in the file that
contain a specified query string. We do not need to change the lines in the file in any way, just put them in a list and
return that list. Don't worry about case
this function is case-insensitive.
If we have the following text in a file called final_sample.txt:
it was the best of times
it was the worst of times
time keeps on slippin into the future
this sentence does not contain that particular word
also this one doesn't contain it either](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc06466e0-b6af-451e-ad3a-a7add978ace4%2F4f3c7243-224d-4a07-979f-731dd7162c7a%2F6uu4cej_processed.png&w=3840&q=75)
Transcribed Image Text:5. select_lines_from_file
In this function, we will open a file for reading, look at each line in the file, and return a list of the lines in the file that
contain a specified query string. We do not need to change the lines in the file in any way, just put them in a list and
return that list. Don't worry about case
this function is case-insensitive.
If we have the following text in a file called final_sample.txt:
it was the best of times
it was the worst of times
time keeps on slippin into the future
this sentence does not contain that particular word
also this one doesn't contain it either
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
![Microsoft Visual C#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![Programming with Microsoft Visual Basic 2017](https://www.bartleby.com/isbn_cover_images/9781337102124/9781337102124_smallCoverImage.gif)
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning