Print a New Line With Python 3

If you ever used the print command in Python to print strings, variables or any other values, you might wonder if it is possible to print part of the string in a new line.

New Line (\n)

With the Python print function, we can break down our printing into multiple lines, as shown in the following example.

blogs = "1.blog1\n2.blog2"
print (blogs)

As shown above, I am using the \n code to start a new line as part of the string. ( I can also use the \n inside the print statement ).

The output is shown below.


Leave a comment

Your email address will not be published.