splitting delimited strings

Mark Harrison mh at pixar.com
Thu Jun 16 01:44:22 CEST 2005


Paul McNett <p at ulmcnett.com> wrote:
> Mark Harrison wrote:
> > What is the best way to process a text file of delimited strings?
> > I've got a file where strings are quoted with at-signs, @like this at .
> > At-signs in the string are represented as doubled @@.
> 
> Have you taken a look at the csv module yet? No guarantees, but it may 
> just work. You'd have to set delimiter to ' ' and quotechar to '@'. You 
> may need to manually handle the double-@ thing, but why don't you see 
> how close you can get with csv?

This is great!  Everything works perfectly.  Even the double-@ thing
is handled by the default quotechar  handling.

Thanks again,
Mark

-- 
Mark Harrison
Pixar Animation Studios



More information about the Python-list mailing list