Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a complete Python program with prompts for the user to get the main text file (checks that it exists, and if not, output an

Write a complete Python program with prompts for the user to get the main text file (checks that it exists, and if not, output an error message and stop), for any possible flags (flags allows the user to change the default conditions or to use the defaults, and for any other input that this program may need from the user: split has an option of naming the smaller files. Your program will open the input file once only and using seek(0) to avoid re-opening the file will cost you all points for that part! middle list the middle lines of the file by skipping the first 5 lines (default) and skipping the last 5 lines (default) in order of the given text file flag: # change the number of lines to skip at the top and bottom Comment: If the file has less than 2 times the number of lines to skip, output the entire file. tail_head list the last 5 lines (default) in order first and the first 5 lines (default) second in order of the given text file flag: # output # lines instead of 5 (default) lines Comment: If the file has less than 2 times the requested number of lines, output the entire file in the order requested split split a text file into smaller files (may be useful with the FTP Project) flags: # put # lines of text into each output file (default=1000 lines) input: file file to be split (note extension and use it on split files) name file of newfiles (example: name-aa.ext, name-ab.ext, etc.) name may be blank, so the files are: xaa.ext, xab.ext, etc. (letters only, no numbers) note: your program generates the file names no external file of names allowed! Comment: Output the name of the file as it is being created and filled

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Successful Keyword Searching Initiating Research On Popular Topics Using Electronic Databases

Authors: Randall MacDonald, Susan MacDonald

1st Edition

0313306761, 978-0313306761

More Books

Students also viewed these Databases questions