\n is not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

\n is not working

I tried to print following string """thanks you \n boss""" but it result comes the same string and \n is included

24th Jul 2016, 5:32 AM
Abhinav Gaur
Abhinav Gaur - avatar
7 Answers
+ 2
When you use triple quote for string, you don't use \n but you can go to the next line. You can do : """thanks you boss""" or "thank you\nboss" But don't mix the two ! see https://docs.python.org/3/tutorial/introduction.html (section 3.1.2 String)
24th Jul 2016, 6:17 AM
samuel delepoulle
samuel delepoulle - avatar
+ 1
seems like i can just write 2 characters which means only "\"" is possible .... it confused me as the tutorial mentioned a full sentence
25th Jul 2016, 8:33 PM
Ken Sydow
Ken Sydow - avatar
0
Don't try this in the code playground because it actually works in there. Sigh...
24th Jul 2016, 6:36 AM
Gershon Fosu
Gershon Fosu - avatar
0
Hi
24th Jul 2016, 6:02 PM
Jawad Nassan
Jawad Nassan - avatar
0
the \n is still not working
24th Jul 2016, 6:25 PM
Daniel baez
Daniel baez - avatar
0
Daniel you use double quotes? it works fine for me , I tried print("2"+"\n2")
25th Jul 2016, 11:38 AM
Alexander Mogoryan
Alexander Mogoryan - avatar
- 1
That's a comment. If you want to print text, use: print("Hi\nHow Are You?") see? Double quote.
24th Jul 2016, 5:59 AM
Alexis García Pagan
Alexis García Pagan  - avatar