On 2019-01-31, ^Bart <gabriele1nos...@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!"

[...]

> I should have an output like this:
> The
> best
> day
> of
> my
> life!

Here's a solution. But don't turn it in. You're not supposed to know
how to do this yet, and your instructor will know you copied it from the
internet:

print(''.join('\n' if c == ' ' else c for c in text))

-- 
Grant Edwards               grant.b.edwards        Yow! over in west
                                  at               Philadelphia a puppy is
                              gmail.com            vomiting ...

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to