Check sibling questions
Computer Science - Class 12
Chapter 2 - File Handling in Python

Explain Reading CSV files with CSV.

 

Answer:

CSV files are handled using the csv module. The reader class from the module is used for reading from a csv file .

  • At first, the csv file is opened in the read mode using the in-built function open( ).
  • The open( ) function returns a file object.
  • This file object is passed to the reader.

Example:

import csv

f=open( "values.csv" , 'r' )

output=csv.reader(f,delimiter= ',' )

for row in output:

    print(row)

 

 

 

Introducing your new favourite teacher - Teachoo Black, at only ₹83 per month

CA Maninder Singh's photo - Expert in Practical Accounts, Taxation and Efiling

Made by

CA Maninder Singh

CA Maninder Singh is a Chartered Accountant for the past 12 years. He also provides Accounts Tax GST Training in Delhi, Kerala and online.