0% found this document useful (0 votes)
8 views1 page

Worksheet 3 On File Handling

The document outlines various tasks related to handling CSV files in Python, including reading, writing, and parsing CSV files using both the built-in csv library and the pandas package. It also discusses the structure of CSV files, the significance of delimiters, and common practices such as closing files. Additionally, it includes multiple-choice questions regarding the characteristics and usage of CSV files.

Uploaded by

chunchu.nirmala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

Worksheet 3 On File Handling

The document outlines various tasks related to handling CSV files in Python, including reading, writing, and parsing CSV files using both the built-in csv library and the pandas package. It also discusses the structure of CSV files, the significance of delimiters, and common practices such as closing files. Additionally, it includes multiple-choice questions regarding the characteristics and usage of CSV files.

Uploaded by

chunchu.nirmala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1.Write a Python program to read each row from a given csv file and print a list of strings.

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.

4.What is a CSV file


5.How to parse CSV files in Python using the builtin library csv
6.How to parse CSV files in Python using the pandas package
7.What is the advantage of CSV File?
8.How to close a CSV file using close() function.?

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.

You might also like