Joining a list of words : Join « String « Python Tutorial






word1 = "A"
word2 = "few"
word3 = "good"
word4 = "words"
wordList = ["A", "few", "more", "good", "words"]


#Joining a list of words
sentence = "Second:"
for word in wordList:
    sentence += " " + word
sentence += "."
print sentence








5.12.Join
5.12.1.Convert a list of characters back to a string
5.12.2.Joining Strings
5.12.3.Joining a list of words
5.12.4.Token splitting and delimiter joining.