split() and string.whitespace

Chaim Krause chaim at chaim.com
Tue Nov 4 09:52:52 EST 2008


That is a very creative solution! Thank you Scott.

> Or, for faster per-repetition (blending in to your use-case):
>
>      import string
>      SEP = string.maketrans('abc \t', '     ')
>      ...
>      parts = 'whatever, abalone dudes'.translate(SEP).split()
>      print parts
>
> ['wh', 'tever,', 'lone', 'dudes']



More information about the Python-list mailing list