Question: 2 . Write function csv 2 lol ( fName ) that takes a string fName corresponding to the CSV file name and returns a list

2. Write function csv2lol(fName) that takes a string fName corresponding to the CSV file name and returns a list of lists. Each list (in the list of lists) consists of the entries a line in the CSV file produced by .split-ing the line at its commas. You'll write THREE variants of this function, corresponding to different approaches to reading the file and turning it into a list of lists:
Page 1 of 2
CSIS 153(Spring 2024) Prof. Cabanela
readline(): reading a single line at a time.
readlines(): reading all the lines at once.
read(): read the entire file in as one string. You'll have to split the file up by
newline escape characters to get each line.
Your approach should be write the function implementing the first method, readline(), and test it produces a valid list of lists (all versions of the code will produce the same output list of lists). Once you have confirmed it works, comment out the parts of the function that read in the file and implement the next method, readlines(), and then after you get that working, implement read().

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!