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.
--
http://mail.python.org/mailman/listinfo/python-list

The regular expression module has a split function that does what you want.
>>> import re
>>> r =',|;'   # or this also works: '[,;]'
>>> s = "a,b;c"
>>> re.split(r,s)
['a', 'b', 'c']


Gary Herron


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to