Question: Write a Python CLI script that processes a user inputted text file using the argparse module. The code must include: File Path Argument ( file
Write a Python CLI script that processes a user inputted text file using the
argparse module.
The code must include:
File Path Argument file: A string argument for the path to the text file to be
processed.
Operation Argument operation: A choice argument to specify the type of
operation to perform on the file.
Operation options should include:
linecount number of lines
wordcount number of words
uppercase convert all text to uppercase and display
contains used with word, check if file contains the word
Word Argument word: A string argument that specifies a word to find in
the file. This should only be required if the contains operation is selected.
If file path is not found display an error message.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
