I am experiencing the error "key error" on my Python code.
The goal is to open a csv file (I am attaching it) with heading and process the file. Thje first row contains field names and then the values on the following rows.
The relevant code is:
# open the table print("File:[" + selectedFile + "]") with open(selectedFile, "r") as tableFile: reader = csv.DictReader(tableFile) for row in reader: print(row['villCode'])
and as output, I am having:
ile:[/Users/jsp/Documents/02 GIS/01 GW/01 dbms/02 baseTab/11 tabelão e coesão/01 current/tabelaoBaseData.slim.gpsOK.20211030.05C.csv]
Traceback (most recent call last):
File "/Users/jsp/Documents/02 GIS/93 myApps/001 getVillageImages/main.py", line 265, in <module>
The CSV looks OK.tabelaoBaseData.slim.gpsOK.20211030.05C.csv
can anyone help?