[TriZPUG] More Fun With Text Processing

Bradley A. Crittenden brad.crittenden at gmail.com
Fri Apr 3 18:13:22 CEST 2009


On Apr 3, 2009, at 12:03 , Chris Rossi wrote:

> Or maybe it's already outputting tab characters?
>
> Chris
>
>
> On Fri, Apr 3, 2009 at 11:51 AM, Stephan Altmueller <stephan_altmueller at unc.edu 
> > wrote:
> Josh,
>
> I think the first thing you should do is nail down the exact file  
> format.
> If you have missing values and spaces in your format you have no
> unambiguous way
> to decide what column an entry belongs to.
>
> Can you make the command line program insert some sort of delimiter  
> like
> commas ?

Hi Josh,

If your input does have a consistent delimiter you may want to look at  
csv.DictReader, which can read the headers and use them as keys to a  
dictionary it returns you.  The module is called 'csv', but you can  
supply any delimiter to it.

--bac



More information about the TriZPUG mailing list