Create a Long Multiline String in Python Using \ (Backslash)

(Last Updated On: 17/03/2023)

Python Program to Create a Long Multiline String Using \ (Backslash)

# Create a Long Multiline String Using \ in python

my_string = "The only way to \n" \
        	"learn to program is \n" \
        	"by writing code."

print(my_string)

Output:

The only way to 
learn to program is 
by writing code.

Leave a Reply

Your email address will not be published. Required fields are marked *