Worksheet 3 On File Handling
Worksheet 3 On File Handling
2.Write a Python program to read a given CSV file having tab delimiter
3.Write a Python program to write a Python list of lists to a csv file. After writing the CSV file,
read the CSV file and display the content.
9.Assume you have a file object my_data which has properly opened a
separated value file that uses the tab character (\t) as the delimiter.
What is the proper way to open the file using the Python csv module and
assign it to the variable csv_reader?
Assume that csv has already been imported.
A.csv.tab_reader(my_data)
B.csv.reader(my_data)
C.csv.reader(my_data, delimiter='\t')
D.csv.reader(my_data, tab_delimited=True)
10.In separated value files such as .csv and .tsv, what does the first row in the
file typically contain?
A. The author of the table data
B. The source of the data
C. Notes about the table data
D. The column names of the data
11.In regards to separated value files such as .csv and .tsv, what is the
delimiter?
A. Any character such as the comma (,) or tab (\t) that is used to separate
the column data.
B. Delimiters are not used in separated value files
C. Anywhere the comma (,) character is used in the file
D. Any character such as the comma (,) or tab (\t) that is used to separate
the row data
12.