pythonpython-3.x

How to print multiple lines of text with Python


If I wanted to print multiple lines of text in Python without typing print('') for every line, is there a way to do that?

I'm using this for ASCII art in Python 3.5.1.


Solution

  • You can use triple quotes (single ' or double "):

    a = """
    text
    text
    text
    """
    
    print(a)