Skip to content
Related Articles

Related Articles

Improve Article

Multi-Line printing in Python

  • Difficulty Level : Basic
  • Last Updated : 21 Jan, 2019
Geek Week

We have already seen the basic use of print function previous article. Now, let’s see how to use print function for multi-line printing. This can easily be done using multiline string i.e. three single quotes ''' Geeksforgeeks ''' .

Let’s see different examples to see the demonstration for the same.

Example #1:




# basic example for multi-line printing
print(
'''
=======================================
|                                     |
|                                     |
|          GeeksforGeeks              |
|                                     |
|                                     |
=======================================
'''
    )
Output:
=======================================
|                                     |
|                                     |
|          GeeksforGeeks              |
|                                     |
|                                     |
=======================================

Example #2:






# basic example2 for multi-line printing
print(
  '''list.head        second              third 
         |                |                  | 
         |                |                  | 
    +----+------+     +----+------+     +----+------+ 
    | 1  | None |     | 2  | None |     |  3 | None | 
    +----+------+     +----+------+     +----+------+ 
    '''
    )
Output:
list.head        second              third 
         |                |                  | 
         |                |                  | 
    +----+------+     +----+------+     +----+------+ 
    | 1  | None |     | 2  | None |     |  3 | None | 
    +----+------+     +----+------+     +----+------+

 Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.  

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course




My Personal Notes arrow_drop_up
Recommended Articles
Page :