[Tutor] Syntax Error Messages
tmantjg at yahoo.com
Fri Oct 22 20:49:07 CEST 2010
Am new to Python, and having difficulty with Error Messages
I 'm using Python 3.1
And PyScripter as my editor
I want to process a comma delimited file one line at a time and
Interact with the fields within each line.
I found this script when looking at the CVS module and loaded
It into PyScripter, but get: Syntax Error: Invalid Syntax
Cannot figure out why and Googleing for help doesn't help
import csv, sys
filename = "some.csv"
reader = csv.reader(open(filename, "rb"))
for row in reader:
except csv.Error, e:
sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor