string processing while parsing into dictionary
<p>I have a string in the following format:</p>

<pre><code>"2A:xxx\r\n3A:yyyy\r\n51:yzzzz\r\n52:yzyeys\r\n4A:....."
</code></pre>

<p>This needs to be converted into a dictionary by splitting at the \r\n.<br>
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.<br>
So the final expected output is as follows:</p>

<pre><code>{'2A':'xxxx','3A':'yyyy','3A-51':'yzzzz','3A-52':'yzyeys','4A':'.....}
</code></pre>

<p>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?</p>
