String split with " and/or ' and/or \<sep>

Paul McGuire ptmcg at austin.rr.com
Tue Jun 24 05:32:12 EDT 2008


On Jun 24, 3:56 am, Kurt Mueller <kurt.muel... at aerodynamics.ch> wrote:
> How to (super)split a string (literal) containing " and/or ' and/or \<sep>.
>
> example:
>
> ' a  "  b b   "  c\ c '.supersplit(' ')
> ->
> ['a', '  b b   ', 'c c']
>
> Thanks and Grüessli
> --
> Kurt Müller:
> kurt.muel... at aerodynamics.ch

>>> re.split(r'''['"\\]''',' a  "  b b   "  c\ c ')
[' a  ', '  b b   ', '  c', ' c ']



More information about the Python-list mailing list