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

Зміст курсу

String Manipulation in Python

String Manipulation in Python

1. Basic Concepts
2. String Methods
3. Strings Formatting

Multiline 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,

12345
# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
copy

Note

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

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 2
toggle bottom row

Multiline 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,

12345
# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
copy

Note

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

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

Секція 1. Розділ 2
toggle bottom row

Multiline 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,

12345
# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
copy

Note

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

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів

Все було зрозуміло?

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,

12345
# Creating three-lines string large_string = """Course: String Manipulation in Python Technology: Python Level: Beginner""" print(large_string)
copy

Note

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

Завдання

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

Introduction to Python

String Manipulation in Python

Then print this string into console.

Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 1. Розділ 2
Перейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
We're sorry to hear that something went wrong. What happened?
some-alt