by multiple delimiters. re.split(pattern, str) seems not to work.
example:
str = 'name[20];'
pattern = '[ ] ; < >'
newStr = re.split(pattern, str)
output:
['name[20];']
while i expect it to show ['name', '[', '20', ']'
str.split(uhuh) gives the same output.
how to make it work?
Why do you need re here?
square bracket will evaluated as groups, then you need to use it something like this strings = 'name[20];' patterns = "[ \\[\\]<>; ]" newStr = re.split(patterns, strings) try it
Обсуждают сегодня