I have a string, let's say "MDP-A-17_MDP-A-23.3"
. I want this string split based on "-"
, "_"
and "."
.
The output will be a list:
["MDP", "A", "17", "MDP", "A", "23", "3"]
I have a string, let's say "MDP-A-17_MDP-A-23.3"
. I want this string split based on "-"
, "_"
and "."
.
The output will be a list:
["MDP", "A", "17", "MDP", "A", "23", "3"]
Pretty sure you can use re.split, as your question suggests...
import re
s = "MDP-A-17_MDP-A-23.3"
l = re.split(r'[-_.]',s)
Check the docs... http://docs.python.org/2/library/re.html