How to Read CSV File in Python

Vaibhav Mule
PythonPips

--

Read CSV file using Python built-in CSV library

contacts.csv

name, phone_number
Vaibhav, +111111111111
John, +222222222

Read CSV File

import csv with open('contacts.csv') as contact_file:
csv_reader = csv.reader(contact_file, delimiter=',')
csv_reader.__next__() # skip headers of csv file for row in
csv_reader: print(f'Name: {row[0]} Number: {row[1]}')

Like this on Twitter | Like this on Instagram | Like this on Facebook

Subscribe to our newsletter

Originally published at pythonpips.com.

--

--

Vaibhav Mule
PythonPips

College Dropout, Full-Stack Developer, and Aspiring Entrepreneur.