I have a string in the following format:
"2A:xxx\r\n3A:yyyy\r\n51:yzzzz\r\n52:yzyeys\r\n4A:....."
This needs to be converted into a dictionary by splitting at the \r\n.
However,the difficult part is that fact that for the pairs between 3A and 4A,the key needs to be pre-pended by 3A,to make it apparent that they are a sub-set of 3A.
So the final expected output is as follows:
{'2A':'xxxx','3A':'yyyy','3A-51':'yzzzz','3A-52':'yzyeys','4A':'.....}
Is there any easier way than to extract all the data into a dictionary and iterating through the dict later with a for loop. Can this be done in a single parse in-process?