Languages
[Edit]
EN

Python - multiline strings

0 points
Created by:
Haris65
386

In this article, we would like to show you how to create multiline strings in Python.

1. Using single quotation marks

In this example, we use three single quotation marks to create a multiline string.

Practical example:

my_string = '''line1
line2
line3'''

print(my_string)

Output:

line1
line2
line3

2. Using double quotation marks

In this example, we use three double quotation marks to create a multiline string.

Practical example:

my_string = """"line1
line2
line3"""

print(my_string)

Output:

line1
line2
line3

Python - string (popular problems)

Python - multiline strings
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join