Hello,
In this post I am going to explain how to read CSV file using Python. For this I assume that you have python installed in your system. Now we have to install csv package.
sudo pip install csv
This will install csv package for python. Now to read CSV file use, following code.
with open('data.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in reader:
print row[0]
print row[1]
print row[2]
print row[3]
That's it and now you can have read CSV file.
To run python script. Type command
python myscript.py
And that's it.
In this post I am going to explain how to read CSV file using Python. For this I assume that you have python installed in your system. Now we have to install csv package.
sudo pip install csv
This will install csv package for python. Now to read CSV file use, following code.
with open('data.csv', 'rb') as csvfile:
reader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in reader:
print row[0]
print row[1]
print row[2]
print row[3]
That's it and now you can have read CSV file.
To run python script. Type command
python myscript.py
And that's it.