howto split string with both comma and semicolon delimiters

bvdp bob at mellowood.ca
Thu Jun 12 21:06:15 CEST 2008


dmitrey wrote:
> hi all,
> howto split string with both comma and semicolon delimiters?
> 
> i.e. (for example) get ['a','b','c'] from string "a,b;c"
> 
> I have tried s.split(',;') but it don't work
> Thx, D.

Howabout:

	s = s.replace(";", ",")
	s = s.split(",")




More information about the Python-list mailing list