Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Multiline Strings | Basic Concepts
course content

Course Content

String Manipulation in Python

Multiline StringsMultiline Strings

What if we want to store some large text into one variable? By using large comparison, I mean text in multiple lines.

Fortunately, Python allows us to save multiple lines as one string. To do it, use tripled quotation marks. For example,

Note

Like in the previous chapter, you have to use the same quotation marks type (i.e. only single or double).

Task

Assign to variable courses the following string (contains of 2 rows):

Introduction to Python

String Manipulation in Python

Then print this string into console.

Everything was clear?

Section 1. Chapter 2
toggle bottom row
course content

Course Content

String Manipulation in Python

Multiline StringsMultiline Strings

What if we want to store some large text into one variable? By using large comparison, I mean text in multiple lines.

Fortunately, Python allows us to save multiple lines as one string. To do it, use tripled quotation marks. For example,

Note

Like in the previous chapter, you have to use the same quotation marks type (i.e. only single or double).

Task

Assign to variable courses the following string (contains of 2 rows):

Introduction to Python

String Manipulation in Python

Then print this string into console.

Everything was clear?

Section 1. Chapter 2
toggle bottom row
some-alt