sentence = 'This is a sentence' word="" for w in sentence : if w.isalpha(): word=word+w elif not w.isalpha(): print(word) word="" print(word)