python/자료구조 & 알고리즘

[Python] Re 모듈 re.split() 으로 문자열 패턴으로 분리하기

sillon 2022. 10. 2. 17:33
728x90
반응형
import re

s = 'apple orange:banana,tomato'

l = re.split(r'[ ,:]', s)
print(l)

'''
['apple', 'orange', 'banana', 'tomato']

'''

 

728x90
반응형