s.split() on multiple separators

Francesco Guerrieri f.guerrieri at gmail.com
Sun Sep 30 11:48:25 EDT 2007


On 9/30/07, mrkafk at gmail.com <mrkafk at gmail.com> wrote:
> Hello everyone,
>
> OK, so I want to split a string c into words using several different
> separators from a list (dels).

Have a look at this recipe:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303342

which contains several ways to solve the problem. You could both
translate all your separators to a single one, and then split over it,
or (maybe the simpler solution) going for the list comprehension
solution.

francesco



More information about the Python-list mailing list