Advertisement
Guest User

Iterate over CSV rows in a file

a guest
Mar 30th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.31 KB | None | 0 0
  1. import os
  2. import csv
  3.  
  4. my_path = 'Insert here the path to your file'
  5.  
  6. with open(my_path, 'file_name.csv', 'rb') as my_file:
  7.     my_file_reader = cvs.reader(my_file)
  8.     for row in my_file_reader:
  9.         print row # or test something else
  10.  
  11. # PS: Credits to RealPython where I learnt the above algorithm ;)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement