Python CSV Files Example

Do you like this?

Summary:
This shows you how to use Python to access data in CSV files.


Content:

import csv

with open('sample.csv', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=',')
    for row in spamreader:
        print row
What you get is a list of arrays of values as follows:
['row1_column1','row1_column2','row1_column3']
['row2_column1','row2_column2','row2_column3']

 
comments powered by Disqus