How to replace space in a string with \n
Neil Cerutti
neilc at norwich.edu
Thu Jan 31 14:49:59 EST 2019
On 2019-01-31, ^Bart <gabriele1NOSPAM at hotmail.com> 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:
>
> text = "The best day of my life!"
>
> space = (' ')
>
> if text.count(' ') in text:
> space=\n
>
> rightText = text-space
>
> print(rightText)
Your code resembles Python code, but it isn't close enough for me
to offer reasonable help.
You should figure out how to solve your problem *before* you
start to write code. A paper and pencil will be required!
--
Neil Cerutti
More information about the Python-list
mailing list