best split tokens?
Paul Rubin
http
Fri Sep 8 16:50:09 EDT 2006
"Jay" <jaysherby at gmail.com> writes:
> Let's say, for instance, that one was programming a spell checker or
> some other function where the contents of a string from a text-editor's
> text box needed to be split so that the resulting array has each word
> as an element. Is there a shortcut to do this and, if not, what's the
> best and most efficient token group for the split function to achieve
> this?
I'd just use alphabetic strings:
textbox = 'Apple pie and penguins'
words = re.findall('[a-z]+', textbox, re.I)
More information about the Python-list
mailing list