I've been searching for a solution for a few hours now. I have a variable I want to split up in a nested list.
points ="""M445,346c28.8,0,56,11.2,76.4,31.6C541.8,398,553,425.2,553,454s-11.2,56-31.6,76.4C501,550.8,473.8,562,445,562
s-56-11.2-76.4-31.6C348.2,510,337,482.8,337,454s11.2-56,31.6-76.4S416.2,346,445,346 M445,345c-60.2,0-109,48.8-109,109
s48.8,109,109,109s109-48.8,109-109S505.2,345,445,345L445,345z"""
newPoints = re.split(r'[A-Za-z-]', points)
It is a multiline var with x and y positions of points from a svg file.
The pattern is that it starts a new item at a letter. I would like to have it ordered something like the following. I've tried some options like above. One of the mail problems is that it keeps deleting my delimiter. :)
[
[
[command],
[x of p1, y of p1],
[x of p2, y of p2],
[x of p3, y of p3]
]
]
[
[ [M],[445,346] ],
[ [c],[28.8,0],[56,11.2],[76.4,31.6] ]
]
Any pointers are very welcome!