Dear list,

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!

David


'''
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()
print '_'.join(seq2)
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to