PYTHON: Write a program that takes a keyword and one or more file names on the command line. Then for each file specifie

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

PYTHON: Write a program that takes a keyword and one or more file names on the command line. Then for each file specifie

Post by answerhappygod »

PYTHON: Write a program that takes a keyword and one or more
file names on the command line. Then for each file specified by
each filename, print out every line that contains the keyword --
following the format shown below.
E.g.,
% python find.py Foobar report.txt address.txt
homework.py
might result in the following output:
report.txt: an international ring of Foobar bootleggers
address.
txt: Foobar Leitner, Cambridge MA address.
txt: Foobar Industries, North Pole
homework.py: String filename = “Foobar.fum”
Note that the special word being search for is always the
first command line argument.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply