0

I would like to put a comma before all words in title case. For that I tried with tokens:

text="Hey, I would like To Have a chocolate CAKE"
tokens=word_tokenize(text)
for word in tokens:
    if word.istitle():
          word="," + word

But nothing changes in tokens. Why?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
alexdtx
  • 3
  • 1
  • 3

0 Answers0