On 31/01/19 10:18, ^Bart wrote: > Hello everybody! :) > > I got a text and I should replace every space with \n without to use > str.replace, I thought something like this:
Have you even tried to run this? > > text = "The best day of my life!" > > space = (' ') > > if text.count(' ') in text: > space=\n I don't think this does what you think it does. text.count(' ') will return 5, an integer. So you are testing if 5 is in text. But since 5 is an integer that will raise a TypeError. > > rightText = text-space Where does text-space come from? -- Antoon. -- https://mail.python.org/mailman/listinfo/python-list