0
Escaping Newlines
Hello Everybody, So I'm working through the Python 3 tutorial and in regards to strings they talk about inputting "\n" to "Escape a Newline" and I'm not entirely sure what they mean by "escape newline" as well as the "\n". I understood it when putting in an apostrophe for example: print("It wasn\'t supposed to rain today." Thank you in advance for your help.
2 Respuestas
+ 1
when using "\n" the sentence stop and continue in new line
___________________
print ("hello world! ")
print ("hello","\n","world! ")
output
hello world!
hello
world!
_____________________
for second question you can use " at the first and ' when you want in strings like this
print ("what's wrong? ")
but if you want use only ' do it like this
print ('what\'s wrong?)
0
Escaping newlines using \n simply means its going to take you on another line nothing else