title: how to make dictionary/list for x,y coordinate as a key and number/character as value?
body: <p>I have such data structure which is shown below:</p>
  
  <pre><code>data = [[(24, 21), (24, 59), (24, 97), (24, 134), (23, 172)],
          [(419, 19), (419, 57), (419, 95), (419, 133), (419, 170), (419, 208), (419, 245)], 
          [(469, 20), (469, 57), (469, 94), (468, 132), (469, 170)]]
  </code></pre>
  
  <p>I need such structure:</p>
  
  <pre><code>data = [{(24, 21):'1', (24, 59):'2', (24, 97):'3', (24, 134):'4', (23, 172):'0'}, 
          {(419, 19):'1', (419, 57):'2', (419, 95):'3', (419, 133):'4', (419, 170):'0', (419, 208):'x1', (419, 245):'x2'}, 
          {(469, 20):'1', (469, 57):'2', (469, 94):'3', (468, 132):'4', (469, 170):'0'}]
  </code></pre>
  
  <p>Is there any piece of code which can help me sort out this structure or dynamically generate it? Which one is better <strong>list inside dictionary</strong> or <strong>dictionary inside dictionary</strong> for searching key to retrieve value? </p>