Home > Article > Backend Development > Python split string with multiple delimiters
A python delimiter is a sequence of one or more characters used to specify boundaries between separate independent regions in plain text or other data streams; an example of a delimiter is the comma character, which acts as a comma-separated value Field separator in the sequence.
A delimiter is a sequence of one or more characters used to specify boundaries between separate, independent regions in plain text or other data streams. An example of a delimiter is the comma character, which acts as a field separator in a sequence of comma-separated values.
Python code:
import re text = 'The quick brown\nfox jumps*over the lazy dog.' print(re.split('; |, |\*|\n',text))
Output:
['The quick brown', 'fox jumps', 'over the lazy dog.']
Flow chart:
Recommended related Python video tutorials: "Python Tutorial"
This article is an introduction to python delimiters. I hope it will be helpful to friends in need!
The above is the detailed content of Python split string with multiple delimiters. For more information, please follow other related articles on the PHP Chinese website!