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

Зміст курсу

String Manipulation in Python

String Manipulation in Python

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

Splitting

One more possible task is to split the string into separate words or into separate sentences.

Surely, Python can deal with that. Use .split method with separator as an argument (space by default). It will return a list of splits. This function also has the second argument maxsplit defining the number of splits to do (by default - maximum possible). For example,

12
print("Python, R, SQL".split(', ')) print("Hello. My name is John. I'm 31 y/o. Nice to meet you.".split('. '))
copy

By default, this method works from left to right. Like for .strip method, there is .rsplit method that works from right to left.

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

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

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

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

Splitting

One more possible task is to split the string into separate words or into separate sentences.

Surely, Python can deal with that. Use .split method with separator as an argument (space by default). It will return a list of splits. This function also has the second argument maxsplit defining the number of splits to do (by default - maximum possible). For example,

12
print("Python, R, SQL".split(', ')) print("Hello. My name is John. I'm 31 y/o. Nice to meet you.".split('. '))
copy

By default, this method works from left to right. Like for .strip method, there is .rsplit method that works from right to left.

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

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

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

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

Splitting

One more possible task is to split the string into separate words or into separate sentences.

Surely, Python can deal with that. Use .split method with separator as an argument (space by default). It will return a list of splits. This function also has the second argument maxsplit defining the number of splits to do (by default - maximum possible). For example,

12
print("Python, R, SQL".split(', ')) print("Hello. My name is John. I'm 31 y/o. Nice to meet you.".split('. '))
copy

By default, this method works from left to right. Like for .strip method, there is .rsplit method that works from right to left.

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

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

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

One more possible task is to split the string into separate words or into separate sentences.

Surely, Python can deal with that. Use .split method with separator as an argument (space by default). It will return a list of splits. This function also has the second argument maxsplit defining the number of splits to do (by default - maximum possible). For example,

12
print("Python, R, SQL".split(', ')) print("Hello. My name is John. I'm 31 y/o. Nice to meet you.".split('. '))
copy

By default, this method works from left to right. Like for .strip method, there is .rsplit method that works from right to left.

Завдання

Given string libraries. Split it into the list by comma as the separator (as in example).

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