Answers for "python split string by more than one split term"

2

how to split and keep delimiter at the same line in python

#split and keep the dlimeters at the end of the line.
#Ex, using the '.'  '?'  '!' as delimeters.

re.split('(?<=!)|(?<=\.)|(?<=\?)', text)
Posted by: Guest on September-02-2021
0

how to split with multiple delimiters in python

>>> a='Beautiful, is; better*than\nugly'
>>> import re
>>> re.split('; |, |\*|\n',a)
['Beautiful', 'is', 'better', 'than', 'ugly']
Posted by: Guest on September-03-2021

Code answers related to "python split string by more than one split term"

Python Answers by Framework

Browse Popular Code Answers by Language