How can I get a newline by input? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I get a newline by input?

How can I get a newline by input? I tried to type \n and \\n, but they don't work.

2nd Oct 2017, 5:36 AM
G_Paladin_S
3 Answers
+ 2
Just type \n in a string and python automatically generates new line... print ("\n") Note: If you type print ("\\n") the new line character is ignored and you'd get the output \n.
2nd Oct 2017, 5:53 AM
Vamsi Krishna
+ 1
show your prog plz
2nd Oct 2017, 5:47 AM
Oma Falk
Oma Falk - avatar
0
I'm learning Python basic concepts module 7. And I want to know how to use input function to generate new line. In the program I type Hello\nWorld, but no new line generate. https://code.sololearn.com/c8eB9y8bnIoK/?ref=app
2nd Oct 2017, 12:07 PM
G_Paladin_S