◐ Shell
clean mode source ↗

Python Programming Tutorials

Multi-Line printing Python Tutorial

print(
'''
This
is
a
test 
'''
    )

print(
'''
So it works like a multi-line
comment, but it will print out.

You can make kewl designs like this:

==============
|            |
|            |
|    BOX     |
|            |
|            |
==============
'''
    )

The idea of multi-line printing in Python is to be able to easily print across multiple lines, while only using 1 print function, while also printing out exactly what you intend. Sometimes, when making something like a text-based graphical user interface, it can be quite tedious and challenging to make everything line up for you. This is where multi-line printing can be very useful.

If you use IDLE, it should look right. If you use the embedded console, it'll probably be a bit messed up. Feel free to try to fix if you like!

The next tutorial: