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

Chris Miles miles.chris at gmail.com
Fri Nov 16 09:51:23 CET 2007


The built-in csv module is good for this.  You can specify the  
delimiter (ie: tabs instead of commas) and it handles a bunch of edge  
cases (like quoted values containing the delimiter) that makes it a  
better solution than string.split('\t').

Cheers
CM

On 16 Nov 2007, at 19:29, 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?



More information about the python-uk mailing list