How to Split a String

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Fri Nov 30 15:11:13 EST 2007


Siah wrote:

> The basic split/strip method wouldn't split '(a, b, "c,...", d)',
> which is why I chose not to use it.

Could you please explain which part of my example doesn't work?
split takes arguments which enables it to split your string as
desired.
 
> The csv solution seems to work well, that helped me much here
> (thank you), but I am looking to see if I can get it solved with
> some regular expression. This is how far I've come so far, but it
> needs much work: re.compile('"*,"*').split(x[1:-1])

Have fun. Would be too easy without regexps, wouldn't it?

Regards,


Björn

-- 
BOFH excuse #382:

Someone was smoking in the computer room and set off the halon
systems.




More information about the Python-list mailing list