Menu

[Solved]Write a program that first prompts the user to enter the path and name of an input file, followed by a search string

Write a program that first prompts the user to enter the path and name of an input file, followed by a search string. The file should be read using the file.readlines() method. The input file contains a list of strings, each on a separate line. Your program should output all strings from the list that contain the search string. If no matches are found, display the following message: No matches were found. The search should be case insensitive.”

Note – input1.txt is

Wilderness
Aspiration
Transcript
Philosophy
Classified
Federation
Graduation
Zoologists
Millennium
Quadratics

Example Runs

Enter the file path and name of the file: C: \( |C| S 150 \backslash \) input1.txt Enter the string you want to search for: E

Expert Answer


Answer to Write a program that first prompts the user to enter the path and name of an input file, followed by a search string…..

OR


Leave a Reply

Your email address will not be published. Required fields are marked *