[python-uk] Reading a file of tab-separated values

Tim Couper tim.couper at scivisum.co.uk
Fri Nov 16 11:24:20 CET 2007


Best way is to try it out :-)

If you've set it to tab-delimited, then commas are surely not an issue. 
If you've created a csv with stringified tuples, the tuple entries look 
like

...,"(1,2,3)",....

and so the csv module, using a comma delimiter, is not confused by the 
"tuple" commas.

Tim

Dr Tim Couper
CTO, SciVisum Ltd

www.scivisum.com



Alexander Harrowell wrote:
> On Nov 16, 2007 8:57 AM, Mark Summerfield <mark at qtrac.eu> wrote:
>   
>> On 2007-11-16, Jeremy Nicoll - pyuk wrote:
>>     
>>> Is there a simple way to read a whole (modest sized, parameter) file of
>>> lines of tab-separated lines into one Python data-structure?
>>>       
>> I think the csv module can do this. (Despite its name it can handle any
>> delimiter you give it.)
>>     
>
> Can it also handle the situation where you have a gaggle of tuples
> separated by commas? I.e. does it disregard commas nested within
> brackets?
>
>   
>> --
>> Mark Summerfield, Qtrac Ltd., www.qtrac.eu
>>
>>
>> _______________________________________________
>> python-uk mailing list
>> python-uk at python.org
>> http://mail.python.org/mailman/listinfo/python-uk
>>
>>     
> _______________________________________________
> python-uk mailing list
> python-uk at python.org
> http://mail.python.org/mailman/listinfo/python-uk
>
>   


More information about the python-uk mailing list