[Tutor] A string-manipulation question

Alan Gilfoy agilfoy at frontiernet.net
Fri Mar 30 01:15:24 CEST 2007


Hi. I want to learn how to "break down" a string into its component  
words, and then process each word somehow.

Is there a way in Python to separate a string into its component words.

Like this:
"I would like to convert an English string (sentence) into Pig Latin."

The Pig Latin conversion I think I can handle already (if not, I'll  
cross that bridge when I come to it.) However, what I want help on is  
how to make each word of the string a separate value, or at least make  
it able to index the string by word, as opposed to the standard method  
of strings being indexed by character.
-- 
"Computers were the first God-Satan collaboration project."
"Blind faith in bad leadership is not patriotism."

"One of the most horrible features of war is that all the war-propaganda, all
the screaming and lies and hatred, comes invariably from people who are not
fighting."-George Orwell, _Homage to Catalonia







More information about the Tutor mailing list