Anyone help me with multiple delimeters for split function?
For instance, given a string "#1(X,Y)"
, I want to use delimiters such
as (, ',', )
to get a set like ('#1', 'X', 'Y')
Thanks
Anyone help me with multiple delimeters for split function?
For instance, given a string "#1(X,Y)"
, I want to use delimiters such
as (, ',', )
to get a set like ('#1', 'X', 'Y')
Thanks
You separate delimiters with a "|".
For example:
import re
test_string = "'X, Y; Z*W'"
re.split('; |, |\*|\n',test_string)
['X', 'Y', 'Z', 'W']