PythonStringsplit
rstrip

splitString

join

Splits the string by a separator and returns a list.

Syntax

str.split(sep?, maxsplit?)

Example

Enter values below to update the example in real time.

csv
fruits
split
print
sentence
csv = "apple,banana,cherry"
fruits = csv.split(",")
print(fruits)  # ['apple', 'banana', 'cherry']

sentence = "one two three"
print(sentence.split())  # ['one', 'two', 'three']