<div>Hi all.</div><div><br></div><div>I have a lot of text blocks that looks like this one</div><div><br></div><div>*** Layer 3 Message type: CP-Data</div><div>Device: MS1</div><div>Time: 19:57:44.71</div><div>CP-User data</div>

<div>  length : 37</div><div>  RPDU</div><div>    Message type indicator (MTI) : (1) RP-DATA</div><div>      </div><div><br></div><div>The question is how to parse given text block into a dictionary that looks like the dictionary given below?</div>

<div><br></div><div>{'Device':'MS1','Time':'Time: 19:57:44.71','CP-User data':{'length':'37','RPDU':{'Message type indicator (MTI)':'(1) RP-DATA'}}}</div>

<div><br></div><div>Any other thoughts about reading that kind of text?</div><div><br></div><div>Thanks,</div><div>Sergey</div><div><br></div>