Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

15) Write a general function script to search any text file whose name you input (ie. C:/my_files/moby_dick.txt) and any character string (ie. Ishmael) and

 

15) Write a general function script to search any text file whose name you input (ie. "C:/my_files/moby_dick.txt") and any character string (ie. "Ishmael") and a name of an output file (ie. "C:/my_files/ishmael.txt") that will search the text file for any line with an instance of that word, numbers each line, and then outputs any line of text that has that character string. Show me your script for this function. Pick a different Project Gutenberg text and a different word and show the output.

Step by Step Solution

3.47 Rating (163 Votes )

There are 3 Steps involved in it

Step: 1

Python Code read the file names file1inputEnter file2inputEnter open the files f1 openfile1 f2 openf... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mathematical Applications for the Management Life and Social Sciences

Authors: Ronald J. Harshbarger, James J. Reynolds

11th edition

9781337032247, 9781305465183, 1305108043, 1337032247, 1305465180, 978-1305108042

More Books

Students also viewed these Accounting questions

Question

Find Ceq in the circuit of Fig. 6.52 if all capacitors are 4 μF

Answered: 1 week ago