better way of handling list of dict or improving my code
<p>I have a dict </p>

<pre><code>my_dict =
    { '123@com' : [ { 'event': 'event1', 'oldval' = 1, 'newval = 2}, { 'event': 'event2', 'oldval' = 11, 'newval': 22}, { 'event': 'event3', 'oldval' = 33, 'newval': 44}] 
    {'1234@com' : { 'event1': 'oldval': 45, 'newval': 66},
    {'12345@com': [ {'event':'event2', 'oldval': 77, 'newval': 99}, { 'event': 'event3', 'oldval': '99', 'newval': 100'}]
</code></pre>

<p>So basically my goal is to build a list </p>

<pre><code> [ ['123@com', (2,1,True), (22,11, True), (44,33,True)], ['1234@com', (66,45,True), ('','',False),('','',False)], ['12345@com', ('',''False), (99,77,True), (100,99)]]
</code></pre>

<p>So my goal is to capture the value if event is changed and get the values and marked as true.</p>

<p>So the code which I am writing is as follows: </p>

<pre><code>for key,value in my_dict.items():
  if str(my_dict).find('event1') &gt;- 1 or str(my_dict).find('even2') &gt; 1 or str(my_dict).find('event3') &gt; -1: 
  tmp_list = []
  tmp_list.append(key)
  if type(value) is dict:
    if value['event'] == 'event1': 
       @ get all the value and append to tmp_list
    if value['event'] == 'event2':
      @ do the same thing as above
  else:
     for val in value:
      if val['name'] == 'event':
        @ do the same stuff. 
      @do the same stuff again for rest of event. 
</code></pre>

<p>So basically I am able to achieve my goal by following the above code pattern. </p>

<p>So any one can help me out in coding better,I will really appreciate it.
I don't like the way I am coding. </p>

<p>Thanks</p>
