Post

PythonPython

J
James ROBERT

Posted on 4th March 2024|10 views

0
votes

Python Csv To List

How to Read a CSV into the list of lists in python?

Answers
P
Altaf syed

Posted on 4th March 2024

Let us assume you have a CSV file of employee.csv, and the contents are like

 

Id name department

31 raj sales

32 jai business development

33 veer content writing     

 

Import CSV to list of lists

 

from csv import reader

 

with open('employee.csv', 'r') as read_obj:

  

   csv_reader = reader(read_obj)

  

   list_rows = list(csv_reader)

   print(list_rows)

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos