Skip to content

Instantly share code, notes, and snippets.

@SuAlvarez
Created February 2, 2012 05:15
Show Gist options
  • Save SuAlvarez/1721637 to your computer and use it in GitHub Desktop.
Save SuAlvarez/1721637 to your computer and use it in GitHub Desktop.
import csv
ifile = open('test.csv', "rb")
reader = csv.reader(ifile)
rownum = 0
for row in reader:
# Save header row.
if rownum == 0:
header = row
else:
colnum = 0
for col in row:
print '%-8s: %s' % (header[colnum], col)
colnum += 1
rownum += 1
ifile.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment