I updated the SCSV.py parser to handle csv files with named headers
Examples:
Without headers:
from app.csv import SCSV
path = "C:\\Users\\User\\Desktop\\Training\\Materials\\presList.csv"
data = SCSV()
data.opencsv(path)
info = data.nextrow()
while info:
president = info[1]
wikientry = info[2]
print president, wikientry
info = data.nextrow()
data.close()
With headers:
from app.csv import SCSV
path = "C:\\Users\\User\\Desktop\\Training\\Materials\\presList.csv"
data = SCSV()
data.enableheaders()
data.opencsv(path)
info = data.nextrow()
while info:
president = info["President"]
wikientry = info["Wikipedia Entry"]
print president, wikientry
info = data.nextrow()
data.close()
csv_headers.py (13.2 KB)