Make a read function, called read, for a file editing progra. the read function accepts a string
Question:
Make a read function, called read, for a file editing progra.
the read function accepts a string argument using a single parameter variable named file_name. This string, file_name, will have the name of the file to open.
the read function is a value returning functio.
any possible exception should be handled with Try/Except blocks.
the read function will attempt to open the file using the file-name argument value for the filename.
read each line, one at a time.
Add a line number to each line on the left side beginning with 1, then print the line contents
Make sure to include this for every line in the file. the read function returns 0 when no error occur, or it returns -1 when some error occurs.
When the file to be read exist but is empty, return 4. **this only happens when the file is opened but no lines are read
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill