issue with CVS module

Fillmore fillmore_remove at hotmail.com
Fri Mar 11 15:32:19 EST 2016


On 3/11/2016 3:05 PM, Joel Goldstick wrote:
>
> Enter the python shell.  Import csv
>
> then type help(csv)
>
> It is highly configurable
>

Possibly, but I am having a hard time letting it know that it should 
leave each and every char alone, ignore quoting and just handle strings 
as strings. I tried playing with the quoting related parameters, to no 
avail:

Traceback (most recent call last):
   File "./myscript.py", line 47, in <module>
     myReader = csv.reader(csvfile, delimiter='\t',quotechar='')
TypeError: quotechar must be set if quoting enabled

I tried adding CVS.QUOTE_NONE, but things get messy :(

Traceback (most recent call last):
   File "./myscript.py", line 64, in <module>
     sys.stdout.write("\t"+row[h])
IndexError: list index out of range

Sorry for being a pain, but I am porting from Perl and  split 
/\t/,$line; was doing the job for me. Maybe I should go back to split on 
'\t' for python too...




More information about the Python-list mailing list