Splitting with quoted strings?

Chris Barker chrishbarker at home.net
Mon May 7 18:03:53 EDT 2001


Is there any nifty way to do a string.split() that doesn't split inside
quotes?

what I want is (for example):

'this that "the other" some more'.split()

to give me ['this', 'that', 'the other', 'some', 'more'] 

I would ideally like it to be pretty fast. It turns out this is pretty
common in a bunch of the text files I need to read, and it is also a
form put out by Excel, and used for *nix command lines, etc., so I
figured someone might have written a nice extension to do this.


Thanks, Chris




-- 
Christopher Barker,
Ph.D.                                                           
ChrisHBarker at home.net                 ---           ---           ---
http://members.home.net/barkerlohmann ---@@       -----@@       -----@@
                                   ------@@@     ------@@@     ------@@@
Oil Spill Modeling                ------   @    ------   @   ------   @
Water Resources Engineering       -------      ---------     --------    
Coastal and Fluvial Hydrodynamics --------------------------------------
------------------------------------------------------------------------



More information about the Python-list mailing list