python string.split multiple delimiters code example
Example 1: multi split python
str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = str.split(',')
print(str)
import re
str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = re.split(r';|,|\.', str)
print(str)
Example 2: how to split a string in python with multiple delimiters
>>> a='Beautiful, is; better*than\nugly'
>>> import re
>>> re.split('; |, |\*|\n',a)
['Beautiful', 'is', 'better', 'than', 'ugly']
Example 3: python split multiple delimiters
a = "Hello, what is your name? I'm Bob."
a.replace('? ', ', ')
print(a)
a.split(", ")
print(a)