Tokenize a string: Difference between revisions

Content added Content deleted
(Nicer variable names)
Line 226:
'''Interpreter:''' Python 2.5
 
words text = "Hello,How,Are,You,Today"
list_of_words tokens = wordstext.split(',')
print '.'.join(list_of_wordstokens)
 
If you want to print each word on its own line:
 
for wordtoken in list_of_wordstokens:
print wordtoken
 
or
 
print "\n".join(list_of_wordstokens)
 
==[[Ruby]]==