Question #5977   Submitted by Answiki on 02/27/2022 at 05:35:51 PM UTC

What is \n in Python?

Answer   Submitted by Answiki on 02/27/2022 at 05:35:24 PM UTC

As in many other languages, in Python \n is for new line (or line feed). It creates a new line in a string.


For example:

>>> print ("First line \n new line")
First line 
 new line

7 events in history
Question by Answiki 02/27/2022 at 05:35:51 PM
What is \n in Python?
Question by Answiki 02/27/2022 at 05:35:44 PM
What is « \n » in Python?
Question by Answiki 02/27/2022 at 05:35:35 PM
What « \n » is for in Python?
Answer by Answiki on 02/27/2022 at 05:35:24 PM

As in many other languages, in Python \n is for new line (or line feed). It creates a new line in a string.


For example:

>>> print ("First line \n new line")
First line 
 new line

Answer by Answiki on 02/27/2022 at 05:35:16 PM

As in many other languages, in Python \n is for new line (or line feed). It creates a new line in a string.


For example:

>>> print ("First line \n new line")
First line 
 new line

Answer by Answiki on 02/27/2022 at 05:33:31 PM

As in many other languages, in Python \n is for carriage return. It creates a new line in a string. For example:

>>> print ("First line \n new line")
First line 
 new line

Question by Answiki 02/27/2022 at 05:30:38 PM
What \n is for in Python?
# ID Query URL Count

Icons proudly provided by Friconix.