Question: This must be in Python! Write a function that accepts a filename as input argument and reads the file and saves each line of the

This must be in Python!

Write a function that accepts a filename as input argument and reads the file and saves each line of the file as an element in a list (without the new line (" ")character) and returns the list. Ask the user :

 Enter the input file name: 

Each line of the file has comma separated values: For example

 Alan,Williams,27 Layla,Trinh,21 Brayden,Huang,22 

Then the function should return a list such as :

 ['Lucas,Turing,22', 'Alan,Williams,27', 'Layla,Trinh,21', 'Brayden,Huang,22'] 

Should catch the exception if file not existed. Let the system decide to display the error message.

This must be in Python! Write a function that accepts a filename

O_exc.py 1 def list fr om_file(file_name): # Your code goes here # 4 5 6 7 def main): file_name - input("Enter the input file name: ) # Your code goes here # 13 10 12 13 14 main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!