> 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
A very pedestrian solution would be:
def multisplit( s, seps ):
words = [ ]
word = ''
for char in s:
if char in seps:
if word:
words.append( word )
word = ''
else:
word += char
if word:
words.append( word )
return words
Cheers,
Daniel
--
Psss, psss, put it down! - http://www.cafepress.com/putitdown
--
http://mail.python.org/mailman/listinfo/python-list