Use the str.split method:

>>> "MATCHES__STRING".split("__")
['MATCHES', 'STRING']
Answer from adamk on Stack Overflow
🌐
W3Schools
w3schools.com β€Ί python β€Ί ref_string_split.asp
Python String split() Method
Remove List Duplicates Reverse ... Study Plan Python Interview Q&A Python Bootcamp Python Training ... The split() method splits a string into a list....
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί python β€Ί python-string-split
Python split() Method - GeeksforGeeks
4 weeks ago - It returns the resulting parts as a list of strings. ... Explanation: s.split(',') splits the string s at every comma and returns a list of the parts ['one', 'two', 'three'].
Discussions

Trying to understand string split()
When you're calling split() (without arguments) the split will be done on any number of spaces. It is not the same as calling split(' '). '-a-b'.split('-') # returns ['', 'a', 'b'] ' a b'.split(' ') # returns ['', 'a', 'b'] ' a b'.split() # returns ['a', 'b'] More on reddit.com
🌐 r/learnpython
7
0
January 31, 2024
Split a string by a delimiter in Python - Stack Overflow
Consider the following input string: 'MATCHES__STRING' I want to split that string wherever the "delimiter" __ occurs. This should output a list of strings: ['MATCHES', 'STRING'] To spli... More on stackoverflow.com
🌐 stackoverflow.com
python - How do I split a string into a list of characters? - Stack Overflow
How do I split a string into a list of characters? str.split does not work. "foobar" β†’ ['f', 'o', 'o', 'b', 'a', 'r'] More on stackoverflow.com
🌐 stackoverflow.com
How to split each string into words and collects all words in a new list.
string.split() return a list or words, so if you put [s.split()] it would return a list of lists. i would try something like this: new_list = [] for line in book: for word in line.split(' '): new_list.append(word) More on reddit.com
🌐 r/learnpython
6
4
May 9, 2021
🌐
Python
docs.python.org β€Ί 3.3 β€Ί library β€Ί stdtypes.html
4. Built-in Types β€” Python 3.3.7 documentation
If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result. ... Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator.
Find elsewhere
🌐
Mimo
mimo.org β€Ί glossary β€Ί python β€Ί string-split-method
Learn Python's String Split Method, Simplify Text Processing
To split a string into a list of substrings, you use the built-in string method .split(). Its behavior depends on the arguments you provide. ... Become a Python developer.
🌐
ReqBin
reqbin.com β€Ί code β€Ί python β€Ί nxrhfweu β€Ί python-split-string-example
How do I split a string in Python?
December 20, 2022 - In some rare cases, you can split a Python string using the range operator [] to take a subrange of characters from the string. In this Python Split String example, we use the string.split() method to split the string into a list. Other splitting options are presented below, with detailed examples and a description of each.
🌐
Python
docs.python.org β€Ί 3.6 β€Ί library β€Ί stdtypes.html
4. Built-in Types β€” Python 3.6.15 documentation
If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result. ... Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator.
🌐
Reddit
reddit.com β€Ί r/learnpython β€Ί how to split each string into words and collects all words in a new list.
r/learnpython on Reddit: How to split each string into words and collects all words in a new list.
May 9, 2021 -

I'm working on a book I've downloaded from project Guttenberg and after doing some data cleaning I have ended up with a list of strings. Next I should split each string into words and collect all the words in a new list.

I have tried to use the split commando but somehow I end up with transforming each string into a list instead of a a string.

I'm sorry if I'm being vague. Please let me know if I should provide more infromation...

I have created the following function.

def splitter():

wordList = [s.split(" ") for s in book]

return wordList

book = splitter()

Somehow I end up with the following output when I type book[0] into the console:

['the',

'history',

'of',

'australian',

'exploration',

'from',

'1788',

'to',

'1888']

Instead of splitting the string and ending up with a list of strings I have created a list of lists.

What I want to end up with is:

In[] book[0]

Out[] the

and

in[] book[:9]

['the',

'history',

'of',

'australian',

'exploration',

'from',

'1788',

'to',

'1888']

🌐
Python Reference
python-reference.readthedocs.io β€Ί en β€Ί latest β€Ί docs β€Ί str β€Ί split.html
split β€” Python Reference (The Right Way) 0.1 documentation
returns [β€˜1’, β€˜2’, β€˜3’]). Splitting an empty string with a specified separator returns [β€˜β€™].
🌐
Note.nkmk.me
note.nkmk.me β€Ί home β€Ί python
Split a String in Python (Delimiter, Line Breaks, Regex) | note.nkmk.me
May 4, 2025 - This article explains how to split strings in Python using delimiters, line breaks, regular expressions, or a number of characters. Split a string by delimiter: split()Specify the delimiter: sepLimit ...
🌐
Python Morsels
pythonmorsels.com β€Ί string-split-method
The string split method in Python - Python Morsels
September 27, 2024 - Strings can be split by a substring separator. Usually the string split is called without any arguments, which splits on any whitespace. Trey Hunner Sept. 27, 2024 2 min read 01:48 video Python 3.10β€”3.14
🌐
Medium
medium.com β€Ί @huasa0115 β€Ί python-how-to-use-string-split-method-ee77458839d8
[Python] How to use String split() method? | by Yi-Ning Huang | Medium
July 16, 2025 - It splits on any sequence of whitespace characters (spaces, tabs, newlines) and it automatically removes leading/ trailing whitespaces. Extra spaces between words are treated as one separator.
🌐
Real Python
realpython.com β€Ί python-split-string
How to Split a String in Python – Real Python
November 4, 2024 - The .split() method in Python is a versatile tool that allows you to divide a string into a list of substrings based on a specified delimiter. By default, .split() separates a string at each occurrence of whitespace, which includes spaces, tabs, ...