Python CSV – Reading data from a CSV file

In this post we will be creating a Python script that will read data from a CSV file. To do this we will be using the CSV module, in particular its reader object which will allow us to read sequences.

We begin by importing the CSV module, defining the location of our CSV file and initiating a reader object. We then iterate through each row of the CSV, note that each row read from the CSV is returned as a list of strings. Using the Join method we can join each row as a single string.

The full source code can found below.

import csv

with open('File.csv') as file:
    reader = csv.reader(file)

    for row in reader:
        print(','.join(row))

Leave a Reply