Alan Gilfoy wrote: > 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. >
"I would like to convert an English string (sentence) into Pig Latin.".split() yields: ["I", "would", "like", "to", "convert", "an", "English", "string", "(sentence)", "into", "Pig Latin."] -- Bob Gailer 510-978-4454 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor