Answers for "python read_csv to list"

2

python read csv into array

import csv 

items = []

with open('file.csv') as csvfile:    
	csvReader = csv.reader(csvfile)    
	for row in csvReader:        
		items.append(row[0])        
print(items)
Posted by: Guest on March-23-2020
2

read csv as list python

import csv

with open('file.csv', newline='') as f:
    reader = csv.reader(f)
    data = list(reader)

print(data)
Posted by: Guest on November-08-2020

Python Answers by Framework

Browse Popular Code Answers by Language