Problems with csv module

Florian Lindner Florian.Lindner at xgm.de
Wed May 11 07:20:26 EDT 2005


Richie Hindle wrote:

> 
> [Florian]
>> I've one problem using the csv module.
>> The code:
>> 
>>         self.reader = csv.reader(f, delimiter = ",")
>> 
>> works perfectly. But when I use a variable for delimiter:
>> 
>>         self.reader = csv.reader(f, delimiter = Adelimiter)
>> 
>> I get the traceback:
>> 
>> 
>> File "/home/florian/visualizer/ConfigReader.py", line 13, in __init__
>>     self.reader = csv.reader(f, delimiter = Adelimiter)
>> TypeError: bad argument type for built-in operation
> 
> Is this your problem?:
> 
>>>> Adelimiter = u','
>>>> reader = csv.reader(f, delimiter=Adelimiter)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: bad argument type for built-in operation
>>>> print type(Adelimiter)
> <type 'unicode'>

Yes, thats my problem.

You mean that csv.reader can't work with unicode as the delimiter parameter?
Sorry, I don't really get your point what you're saying...

Florian



More information about the Python-list mailing list