I would like to get the string 10M5D8P into a dictionary:
M:10, D:5, P:8 etc. ...
The string could be longer, but it's always a number followed by a single letter from this alphabet: MIDNSHP=X
As a first step I wanted to split the string with a lookbehind and lookahead, in both cases matching this regex: [0-9]+[MIDNSHP=X]
So my not working solution looks like this at the moment:
import re
re.compile("(?<=[0-9]+[MIDNSHP=X])(?=[0-9]+[MIDNSHP=X])").split("10M5D8P")
It gives me an error message that I do not understand: "look-behind requires fixed-width pattern"