Splitting a String with Multiple Delimiters in Python

The following example code shows how to split a string with multiple delimiters in Python:


import re

text = "19.23:34.45:56.56"
pattern = re.compile(r"[.:]")
splitted_text = pattern.split()
print(splitted_text[0])
Output:
19