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

2007-11-16 Thread Alexander Harrowell
Works anyway. Thanks. ___ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk

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

2007-11-16 Thread Alexander Harrowell
On Nov 16, 2007 2:31 PM, Tim Head <[EMAIL PROTECTED]> wrote: > On 16/11/2007, Alexander Harrowell <[EMAIL PROTECTED]> wrote: > > On Nov 16, 2007 8:57 AM, Mark Summerfield <[EMAIL PROTECTED]> wrote: > > > On 2007-11-16, Jeremy Nicoll - pyuk wrote: > > > > Is there a simple way to read a whole (modes

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

2007-11-16 Thread Tim Head
On 16/11/2007, Alexander Harrowell <[EMAIL PROTECTED]> wrote: > On Nov 16, 2007 8:57 AM, Mark Summerfield <[EMAIL PROTECTED]> 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 o

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

2007-11-16 Thread Tim Couper
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

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

2007-11-16 Thread Alexander Harrowell
On Nov 16, 2007 8:57 AM, Mark Summerfield <[EMAIL PROTECTED]> 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. (Des

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

2007-11-16 Thread Chris Miles
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

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

2007-11-16 Thread Mark Summerfield
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.) -- Mark Summerfield