Chris Torek wrote:
On 2011-06-03, ru...@yahoo.com <ru...@yahoo.com> wrote:
[prefers]
    re.split ('[ ,]', source)

This is probably not what you want in dealing with
human-created text:

    >>> re.split('[ ,]', 'foo bar, spam,maps')
    ['foo', '', 'bar', '', 'spam', 'maps']

I think you've got a typo in there... this is what I get:

--> re.split('[ ,]', 'foo bar, spam,maps')
['foo', 'bar', '', 'spam', 'maps']

I would add a * to get rid of that empty element, myself:
--> re.split('[ ,]*', 'foo bar, spam,maps')
['foo', 'bar', 'spam', 'maps']

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

Reply via email to