[Tutor] Syntax Error Messages
Terry Green
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
Any ideas?
import csv, sys
filename = "some.csv"
reader = csv.reader(open(filename, "rb"))
try:
for row in reader:
print (row)
except csv.Error, e:
sys.exit('file %s, line %d: %s' % (filename, reader.line_num, e))
thanks,
Terry Green
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101022/7207fcc3/attachment-0001.html>
More information about the Tutor
mailing list