Answers for "python split string on multiple numbers"

5

multi split python

str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = str.split(',')
print(str) # Output ['Lorem; ipsum. dolor sit amet', ' consectetur adipiscing elit.']

import re
str = 'Lorem; ipsum. dolor sit amet, consectetur adipiscing elit.'
str = re.split(r';|,|.', str)
print(str) # Output ['Lorem', ' ipsum', ' dolor sit amet', ' consectetur adipiscing elit', '']
Posted by: Guest on May-04-2020

Code answers related to "python split string on multiple numbers"

Python Answers by Framework

Browse Popular Code Answers by Language