15) Write a general function script to search any text file whose name you input (ie....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. ● 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. ●
Expert Answer:
Answer rating: 100% (QA)
Python Code read the file names file1inputEnter file2inputEnter open the files f1 openfile1 f2 openf... View the full answer
Related Book For
Mathematical Applications for the Management Life and Social Sciences
ISBN: 978-1305108042
11th edition
Authors: Ronald J. Harshbarger, James J. Reynolds
Posted Date:
Students also viewed these accounting questions
-
In January 2014 the so-called "Polar Vortex" of dense, frigid air plunged deep into the United States and resulted in record cold temperatures and dangerous wind chills. If s is the wind speed in...
-
Some of Tollakson Corporations investments in debt securities are classified as trading securities and some are classifi ed as available-for-sale. The cost and fair value of each category at December...
-
A monolithic floor system consists of 100 mm thick slabs supported by beams 250 mm wide, 1.8 m on centers. The floor carries a superimposed dead load of 1.0 kPa and live load of 4.2 kPa. For a...
-
Classify the effect of a distribution in a year when the distributing corporation has the following conditions. a. A deficit in accumulated E & P and a positive amount in current E & P. If a...
-
Show that the error E(f ) for Composite Simpson's rule can be approximated by h4/180 [f''' (b) f'''(a)].
-
A cogeneration plant is to generate power and 8600 kJ/s of process heat. Consider an ideal cogeneration steam plant. Steam enters the turbine from the boiler at 7 MPa and 500°C. One-fourth of the...
-
FRAUD PREVENTION AND DETERRENCE IN ACTION Assume the following facts: thirty-day collection period. The invoice is used to post-sales to the accounting system. Checks are received in the mailroom and...
-
Comprehensive Accounting Change and Error Analysis Problem Botticelli Inc. were organized in late 2008 to manufacture and sell hosiery. At the end of its fourth year of operation, the company has...
-
1. An object of mass of 4 kg is resting at a height of 2 m and then falls to the ground. a. Model the energy of the object-Earth system with Energy Bar Charts when at the initial height and ground...
-
Kerosene at 250 F must be cooled to 180 F by using ethylene glycol, which is available at 72 F. The mass flow rate of kerosene is 150,000 Ibm/hr. You are asked to size a heat exchanger for this...
-
Two spheres have masses M (sphere 1) and 4.00M (sphere 2). Let their radii be R and 3.00R, respectively. The spheres are released from rest when the distance between their centers is 14.0R.
-
When an indorsement is forged or unauthorized, who bears the burden of loss?
-
The central finance function is one of the central corporate functions of a conglomerate. Do you foresee a trend towards the formation of a global swapping bank account? What are the pros and cons of...
-
Mukisa makes out a check Pay to the order of Adroa. Adroa indorses the check on the back by signing his name. Before Adroa signed his name, the check was a. bearer paper. b. order paper. c. both a...
-
An unauthorized signature usually binds the person whose name is forged. (True/False)
-
The rights and duties of a bank and its customers are partly contractual.(TRUE/FALSE)
-
If a company sold some old equipment when recording the transaction, how many of the columns used in the accounting framework would include a positive number assuming the equipment was sold at a loss?
-
In Exercises 105108, evaluate each expression without using a calculator. log(ln e)
-
1. Indicate whether each given expression is one or more of the following: rational, irrational, integer, natural, or undefined. (a) (b) 0/6 (c) 6/0 2. Insert the proper sign ( ) to replace each (a)...
-
Danny Metzger's parents invested $1600 when he was born. This money is to be used for Danny's college education and is to be withdrawn in four equal annual payments beginning when Danny is age 19....
-
Suppose that a wholesaler expects that his monthly revenue, in dollars, for an electronic game will be R(x) = 100x - 0.1x2, 0 x 800 where x is the number of units sold. Find his marginal revenue...
-
Crane l uses 10 kJ of energy to lift a 50 kg box to the roof of a building. Crane 2 uses 20 kl to lift a 100 kg box the same distance. Which crane is more efficient? A. Crane 1 B. Crane 2 C. Both...
-
Christina throws a javelin into the air. As she propels it forward from rest, she does 270 J of work on it. At its highest point, its gravitational potential energy has increased by 70 J. What is the...
-
Two samples of ideal gas, sample 1 and sample 2, have the same thermal energy. Sample l has twice as many atoms as sample 2. What can we say about the temperatures of the two samples? A. T>T B. T = T...
Study smarter with the SolutionInn App