Languages
[Edit]
EN

Python - multiline strings

0 points
Created by:
Haris65
536

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

Alternative titles

  1. Python - multi-line strings
  2. Python - multi line strings
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

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