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 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? >
Like so? import csv input = csv.StringIO('Hello, World\tThe Spanish inquisition\tis coming to town, tomorrow\t(1,2,3,4)') reader = csv.reader(input, delimiter="\t") for line in reader: print line cheers, tim > > > > > > -- > > Mark Summerfield, Qtrac Ltd., www.qtrac.eu > > > > > > _______________________________________________ > > python-uk mailing list > > python-uk@python.org > > http://mail.python.org/mailman/listinfo/python-uk > > > _______________________________________________ > python-uk mailing list > python-uk@python.org > http://mail.python.org/mailman/listinfo/python-uk > -- http://tim.jottit.com/ _______________________________________________ python-uk mailing list python-uk@python.org http://mail.python.org/mailman/listinfo/python-uk