The str.split() method without an argument splits on whitespace:

>>> "many   fancy word \nhello    \thi".split()
['many', 'fancy', 'word', 'hello', 'hi']
Answer from Sven Marnach on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_string_split.asp
Python String split() Method
Remove List Duplicates Reverse a String Add Two Numbers ยท Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Training ... The split() method splits a string into a list.
Discussions

Split string at a space or ","
Use regex, regular expressions. For exmample, import re data = "123 456,789 ABC,DEF GHI" parts = re.split(r'[,\s]+', data) # splits on comma or space print(parts) More on reddit.com
๐ŸŒ r/PythonLearning
4
2
March 27, 2025
Split string by single space only and ignore multiple space?
import re re.split(r'\b\s\b',s) I am not a regular expressions expert, but I think this is what you are talking about More on reddit.com
๐ŸŒ r/learnpython
18
5
March 23, 2020
Using Split only on the first occurrence of a character?
Why not just split with (.) , grab the last two fields; contoso and com ...then join the two with a dot when you're all done? This covers FQDN that might have multiple subdomains too, fwiw. $var.Split(".")[-2,-1] -join "." #this gives you "contoso.com" More on reddit.com
๐ŸŒ r/PowerShell
14
7
May 22, 2015
Splitting a string but would like everything in double quotes to not be split say by space
text.split("\\B") does it for me More on reddit.com
๐ŸŒ r/scala
6
2
October 17, 2017
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ split string by single space only and ignore multiple space?
r/learnpython on Reddit: Split string by single space only and ignore multiple space?
March 23, 2020 -

Let's say I have a string like s = 'This string has double spaces or more in it.\n What to do'

I would like to split it so it becomes ['This', 'string has', 'double spaces', 'or', 'more', 'in', 'it.\n', 'What', 'to', 'do']

How can I ignore multiple spaces and split them as one word?

๐ŸŒ
Python Examples
pythonexamples.org โ€บ python-split-string-by-space
How to Split String by Space in Python?
import re str = '63 41 92 81 69 70' #split string by single space chunks = re.split(' +', str) print(chunks)
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-string-split-including-spaces
Python - String Split including spaces - GeeksforGeeks
July 11, 2025 - import re s = "Hello World Python" # Split the string including spaces res = re.split(r"(\s+)", s) print(res) ... By wrapping \s+ in parentheses, we ensure spaces are captured as separate elements.
๐ŸŒ
Real Python
realpython.com โ€บ python-split-string
How to Split a String in Python โ€“ Real Python
October 22, 2025 - You split a string by spaces in Python using .split() without arguments.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-string-split
Python split() Method - GeeksforGeeks
July 1, 2026 - Explanation: string contains multiple spaces between "Hello" and "world" and split() automatically treats consecutive spaces as a single separator. By default, split() uses whitespace as the separator.
Find elsewhere
๐ŸŒ
Enki
enki.com โ€บ post โ€บ how-to-split-strings-in-python
Enki | Blog - How to Split Strings in Python
The split() method is a built-in function for separating strings using a specified delimiter. Parameter: By default, split() uses a space character (' ') as the delimiter.
๐ŸŒ
Data Science Parichay
datascienceparichay.com โ€บ home โ€บ blog โ€บ python โ€“ split string by space
Python - Split String by Space - Data Science Parichay
February 27, 2022 - To split a string by space in Python, pass the space character " " as a delimiter to the split() function.
๐ŸŒ
Python Guides
pythonguides.com โ€บ python-split-string-by-space
Print Characters in a String Separated by Space in Python
September 15, 2025 - The end=โ€ โ€ part ensures that Python does not insert a newline after each character but instead adds a space. Another clean and Pythonic way is to use the join() function. This is my personal favorite because itโ€™s concise and very efficient for string manipulation.
๐ŸŒ
Great Learning
mygreatlearning.com โ€บ blog โ€บ it/software development โ€บ python string split() method
Python String split() Method
May 28, 2026 - The split() method is used to break up a string into a list of substrings based on a specified delimiter. By default, it splits the string by whitespace, but you can specify any delimiter, such as a comma, semicolon, or custom character.
๐ŸŒ
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 - If we do not specify the separator, by default, any whitespace is a separator. 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. ... Data & Analytics Engineer in US healthcare. Writing about SQL, Python, PySpark, and the healthcare meaning behind the data.
๐ŸŒ
Finxter
blog.finxter.com โ€บ python-split-string-space
Python | Split String Space โ€“ Be on the Right Side of Change
December 6, 2022 - โญSummary: Use "given string".split(' ') to split the given string by space and store each word as an individual item in a list.
๐ŸŒ
Scribd
scribd.com โ€บ document โ€บ 516467885 โ€บ python-split-string-by-space
Python Split String by Space Guide | PDF
It discusses how to use the split() string method to break a string into a list of substrings separated by whitespace as the default delimiter. It also discusses splitting on specific characters or substrings and ...
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-split-a-string-in-python
Python .split() โ€“ Splitting a String in Python
September 8, 2022 - In the example above, each time .split() encountered a space character, it split the word and added the empty space as a list item. When there is no maxsplit argument, there is no specified limit for when the splitting should stop. In the first example of the previous section, .split() split the string each and every time it encountered the separator until it reached the end of the string.
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ python โ€บ standard library โ€บ str โ€บ split()
Python str split() - Split String
December 11, 2024 - Use split() without any arguments, which defaults to splitting the string by whitespace. ... Here, split() divides the string text into words using spaces as the default separator.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ string_split.htm
Python String split() Method
The Python String split() method splits all the words in a string separated by a specified separator. This separator is a delimiter string, and can be a comma, full-stop, space character or any other character used to separate strings.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ python โ€บ string-split-method
Learn Python's String Split Method, Simplify Text Processing
Default Separator is Whitespace: If you call .split() with no arguments, it will split the string by any sequence of whitespace (spaces, newlines, tabs) and discard empty strings. Does Not Modify the Original String: .split() is non-destructive. It returns a new list and leaves the original ...
๐ŸŒ
Finxter
blog.finxter.com โ€บ home โ€บ learn python blog โ€บ python | split string variable spaces
Python | Split String Variable Spaces - Be on the Right Side of Change
December 6, 2022 - Approach: You can use the filter() method to split the string by space. Feed in None as the first argument and the list of split strings as the second argument into the filter function. The filter() function then iterates through the list and filters out the spaces from the given string and ...