best split tokens?
Tim Chase
python.list at tim.thechases.com
Fri Sep 8 16:55:23 EDT 2006
> 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?
Do you mean like
for word in string_from_text_box.split():
spell_check(word)
Every string has a split() method which, by default, splits the
string at runs of whitespace.
>>> help("".split)
will give you more info.
-tkc
More information about the Python-list
mailing list