I have a string:
"2y20w2d2h2m2s"
I need to split it to be like that:
["2y","20w","2d","2h","2m"2s”]
I tried to use re.split but i couldnt make it work
this was my attempt:
time = re.split("s m h d w y", time)
*time is the string above
finally, I will apricate of you would help understand how to make it work
-
1Do the sections you want the string to split into always start with a 2?mapf– mapf2020-05-03 15:02:20 +00:00Commented May 3, 2020 at 15:02
-
a good Q that i forgot to sepcify but its not supposed to be only 2 its supposed to be any numberyotam rec– yotam rec2020-06-07 15:06:12 +00:00Commented Jun 7, 2020 at 15:06
Add a comment
|