Re: s.split() on multiple separators



On 9/30/07, mrkafk@xxxxxxxxx <mrkafk@xxxxxxxxx> 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
.



Relevant Pages

  • Re: s.split() on multiple separators
    ... so I want to split a string c into words using several different ... Have a look at this recipe: ... or going for the list comprehension ...
    (comp.lang.python)
  • Re: Is there a difference between passing "" and passing Nothing to a Windows API ?
    ... Then I guess I'll have to disagree with them, ... so by Francesco Balena and Giusseppe Dimauro and MS Press it is :-) ... the string and simplifies code (because the string doesn`t have to be ... Do they also recommend catch-all exception handling (or On Error ...
    (microsoft.public.dotnet.languages.vb)
  • List Comprehension question
    ... I recently stumbled over List Comprehension while reading the ... Comprehension until I got to Recipe 1.16. ... it looks like the order of evaluation is reversed. ... command is a LC with a single expression and a single 'for' ...
    (comp.lang.python)
  • Re: tasks and protected types
    ... > Fabio de Francesco wrote: ... > Global objects are a _very_ bad idea when doing tasking. ... > Here you make the lenght of the string Msg 0. ... It will fail with a Constraint_Error, but with tasking you don't ...
    (comp.lang.ada)
  • question regarding list comprehensions
    ... I have written chunks of Python code that look this: ... for a in array: ... It seems that a list comprehension could clean up the code, but I seem to have a mental block on list comprehensions. ...
    (comp.lang.python)