+ 2

New line break in python?

Hi dears, What is the method to create a new line break in python output?

3rd Feb 2019, 6:44 PM
Taͣlhͪaͣ_ͥ
6 odpowiedzi
+ 10
To create a new line break use "\n" this symbol.
3rd Feb 2019, 7:35 PM
Arushi Singhania
Arushi Singhania - avatar
+ 2
print has an "end" attribute with a default value of "\n", you can change it to anything you want just by modifying it like this: print(end=value*) *value can be any string, it will be printed in the end of print statement. print also has an attribute "sep" which will work similar, but after each comma separated value in the print.
3rd Feb 2019, 10:20 PM
Seb TheS
Seb TheS - avatar
+ 2
Taͣlhͪaͣ_ͥ Sometimes I confuse \ and /, if it was the problem. \ is for escaping \n, / is for division x/y.
3rd Feb 2019, 10:27 PM
Seb TheS
Seb TheS - avatar
+ 1
Yes! i have been using "\n" but this is not working on my console... that might be some other issue with that. Anyway, thanks. 💐💐💐
3rd Feb 2019, 7:41 PM
Taͣlhͪaͣ_ͥ
+ 1
Can you share the code, because it does work in SoloLearn
3rd Feb 2019, 8:21 PM
Eragon1980
Eragon1980 - avatar
+ 1
Seb TheS i think the problem was placement of \n, that is working well on sololearn. Anyway i needed just to confirm abt it. Now at least I am sure, that problem is not in \n There could be some other thing to see there. Anyway thanks for helping dear :)
3rd Feb 2019, 10:55 PM
Taͣlhͪaͣ_ͥ