Re: How to replace space in a string with \n

^Bart gabriele1NOSPAM at hotmail.com
Thu Jan 31 05:49:09 EST 2019


Il 31/01/19 10:34, Michael Poeltl ha scritto:
> hi,
> Maybe this is a proper way to do what you'd liked to achieve
> 
>>>> text = "The best day of my life!"
>>>> newtext = '\n'.join( text.split() )
>>>> print(newtext)
> The
> best
> day
> of
> my
> life!
>>>>
> 
> yours
> Michael

Thanks Michael, I'll ask to my teacher in the afternoon if he has the 
same idea, you know when you start a new language you should solve 
problems just with few things, when your mind understood how the 
language works you can use every tools of this language! :)

^Bart



More information about the Python-list mailing list