[Tutor] methods split and join in sequence
ldl08 at gmx.net
Sat Jan 31 16:09:54 CET 2009
many thanks for all your help - much appreciated.
Today I have continued reading Harrington, and produced the following
code, which works flawlessly.
I wonder, though, how I could join all the supplied words with
underscores _without_ making use of split first? This I didn't manage.
Thanks for your ideas!
convert text with whitespace, supplied by the user, into a string
joined by underscores.
seq = raw_input("Please write some words: ")
print "You wrote the following words: ", seq
print "The program now joins all words with underscores: ",
seq2 = seq.split()
More information about the Tutor