"Lowell Tackett" <[email protected]> wrote
until I ran across the csv module. Had accomplished this:
coord = csv.reader(open('true_coord'))
for line in coord:
.... print line
....
[' 1001', ' 342821.71900', ' 679492.08300', ' 0.00000', ' ']
[' 1002', ' 342838.55786', ' 679909.81375', ' 0.00000', ' ']
when I realized that the procedure had included leading white space.
...came across--'csv.Dialect.skipinitialspace' which I believe
is the answer to my dilemma. However, my effort to implement
that detail, based on interpreting the skimpy examples in
the documentation:
coord = csv.reader(open('true_coord'),csv.Dialect.skipinitialspace =
True)
File "<stdin>", line 1
SyntaxError: keyword can't be an expression
Reading the module it looks like the dialect is an attribute of the reader
so I would try something like:
coord = csv.reader(open('true_coord'))
coord.dialect.skipinitialspace = True
for line in coord.....
But I've never used dialect so am guessing based on my reading of the docs.
HTH,
Alan G.
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor