On Tue, 17 Jul 2012, Ethan Furman wrote:

When in doubt, don't just 'print', but 'print repr(...)'.

Ethan,

  I'll look at repr(); thanks.

.readline() returns a string,

  I thought so because when I tried ...

col_headers = infile.readline().split(',')  # col_headers is now a list

col_headers is a list, but when I try to print one item using an index
integer python tells me I need an integer rather than a string as an index.
Since that's what I thought I was providing the source of the error was
opaque to me.

But the csv module is probably worth looking into.

  The original script (which did work for a while) uses the csv module, but
the output is DOS (\r\n) rathat than UNIX (\n). That kept triping me when I
manipulated the results untilI ran the file through the dos2unix filter. The
source file is really a text file now; I took off the text quotes since the
list ended up with double-quoted ("'...'") items in the list.

Thanks,

Rich

_______________________________________________
Portland mailing list
[email protected]
http://mail.python.org/mailman/listinfo/portland

Reply via email to