Created
October 20, 2011 23:16
-
-
Save beauvais/1302689 to your computer and use it in GitHub Desktop.
Python for tagging in CSV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assign variable to a csv file read by csv.reader | |
csvFile = csv.reader(open('/Users/Zach/Desktop/survey.csv', 'rb'), delimiter=',') | |
# identify header row | |
header = next(csvFile) | |
# loop rows in csv file, and identify variables for fields | |
for row in csvFile: | |
if row[20] < 0: | |
continue | |
devStatus = row[4] | |
commercial = row[8] | |
industry = row[10] | |
usage = row[12] | |
address = row[14] | |
comment = row[20] | |
print comment | |
>>> | |
comment | |
comment | |
ine 25, in <module> | |
comment = row[20] | |
IndexError: list index out of range |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment