+ 5

How to line break in Python

Is there any way to line break in Python? Like I donā€™t have to code print(ā€œlineā€) print(ā€œbreakā€) to get output of line break

5th Jul 2018, 8:49 PM
šŸŗMichaelšŸŗ
šŸŗMichaelšŸŗ - avatar
15 Answers
+ 5
print("This is text\n") use \n after text
5th Jul 2018, 8:51 PM
Sad
Sad - avatar
5th Jul 2018, 9:02 PM
Sad
Sad - avatar
+ 3
It's /n in some languages, (or \n, I don't remember for sure). I think it's the same in JavaScript too.
6th Jul 2018, 4:03 AM
Caleb Hale
Caleb Hale - avatar
+ 2
like: print ("i \nhelped \nyou")
6th Jul 2018, 2:29 AM
I Am Arthur
I Am Arthur - avatar
+ 2
Caleb Hale its \n .I think that work in C and C+ too
6th Jul 2018, 4:04 AM
I Am Arthur
I Am Arthur - avatar
+ 2
Arthur thanks, good to know.
6th Jul 2018, 4:11 AM
Caleb Hale
Caleb Hale - avatar
+ 2
Caleb Hale with you want to mark someone use "@" and the name of the person
6th Jul 2018, 4:32 AM
I Am Arthur
I Am Arthur - avatar
+ 2
Thanks, Arthur
6th Jul 2018, 5:11 AM
Caleb Hale
Caleb Hale - avatar
+ 2
To break line and start text on next line Use \n Example : print ( " Hi\nHello\nWorld! ") This will print output as follows : o/p = Hi Hello World!
6th Jul 2018, 3:58 PM
Harshal Simpi
Harshal Simpi - avatar
+ 1
Tom You mean print(ā€œline/nbreakā€) for output line break ?
5th Jul 2018, 9:01 PM
šŸŗMichaelšŸŗ
šŸŗMichaelšŸŗ - avatar
+ 1
\n (but I dont know python..)
5th Jul 2018, 9:12 PM
n3m0
n3m0 - avatar
+ 1
print() automatically inserts line break
6th Jul 2018, 1:53 PM
Kev
+ 1
Hello, Michael. Do you want know about what will create a line break at Python programming language, is it? For create line break you need will use a special combination of simbols - /n (backslash plus n).
8th Jul 2018, 10:14 PM
Vladimir Adam
Vladimir Adam - avatar