re.split()

PHOTO EMBED

Wed Feb 18 2026 01:16:09 GMT+0000 (Coordinated Universal Time)

Saved by @komal

import re
text = "apple banana   cherry date"
fruits = re.split(r"\s+", text) # Split by any occurrence of one or more whitespace characters
print(fruits)
content_copyCOPY

To avoid getting empty strings in the resulting list, you might need to process the list further to remove any empty strings, or use regular expressions for more complex splitting logic.