>>> l = "Birds;and,Bees"
>>> l.split(";,")
['Birds;and,Bees']
The way to achieve this is to use the regular expression package and use the re.split(pattern, string, maxsplit=0, flags=0) method available from the package.
>>> import re
>>> re.split(";|,",l)
['Birds', 'and', 'Bees']
The key is to use the "|" operator to indicate multiple delimiters.
More about...Python Split String
ReplyDelete