Python문자열split
rstrip

split문자열

join

구분자로 분할해 리스트를 반환합니다.

문법

str.split(sep?, maxsplit?)

예제

아래 값을 입력하면 예제에 즉시 반영됩니다.

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']