On Thu, Aug 7, 2008 at 2:25 PM, dave selby <[EMAIL PROTECTED]> wrote: > Hi all, > > Is there a neat way to split a string on either of two delimiters ie > space and comma > > Cheers > > Dave
>>> import re >>> string = 'this is, a test of splitting; on two delimiters' >>> re.split(r'[,;]', string) ['this is', ' a test of splitting', ' on two delimiters'] >>> re.split(r'[, ]', string) ['this', 'is', '', 'a', 'test', 'of', 'splitting;', 'on', 'two', 'delimiters'] -- Stand Fast, tjg. [Timothy Grant] _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor