I have a string which I want to split which contains quotes, say
s = '1.2.3."4.5".0.6.7'
I now want to handle "4.5"
as one element since it's quoted:
>>> s.split(".", handle_quotes=True)
['1', '2', '3', '"4.5"', '0', '6', '7']
Can I do this with Pythons on-board tools?
Background: my primary goal is to find the last element which is not a number, in order to split the list at this position:
def split_me(s):
return magic
print(split_me('1.2.3."4.5".0.6.7'))
prints
('1.2.3."4.5"', '0.6.7')