How to replace space in a string with \n

^Bart gabriele1NOSPAM at hotmail.com
Thu Jan 31 04:18:20 EST 2019


Hello everybody! :)
I got a text and I should replace every space with \n without to use 
str.replace, I thought something like this:
text = "The best day of my life!"
space = (' ')
if text.count(' ') in text:
 space=\n
rightText = text-space
 print(rightText)
I should have an output like this:
The
best
day
of
my
life!


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /