title: Converting List of 3 Element Tuple to Dictionary
body: <p>If I have two List of tuples </p>
  
  <pre><code>tuple2list=[(4, 21), (5, 10), (3, 8), (6, 7)]
  
  tuple3list=[(4, 180, 21), (5, 90, 10), (3, 270, 8), (6, 0, 7)]
  </code></pre>
  
  <p>How do I convert it to a dictionary as below,</p>
  
  <pre><code>tuple2list2dict={4:21, 5:10, 3:8, 6:7}
  
  tuple3list2dict={4: {180:21}, 5:{90:10}, 3:{270:8}, 6:{0:7}}
  </code></pre>
  
  <p>I know how to do it for 2 elements in tuples, using,</p>
  
  <pre><code>tuple2list2dict=dict((x[0], index) for index,x in enumerate(tuple2list))
  </code></pre>
  
  <p>But for 3 elements I have problem, have error trying the below,</p>
  
  <pre><code>tuple3list2dict=dict((x[0], dict(x[1], index)) for index,x in enumerate(tuple3list))
  </code></pre>
  
  <p>How do I reuse the above code for 3 element tuple to create a dictionary? </p>
  
  <p>Any pointer appreciated or point me where I could read more on this. Have trouble finding it in the internet.</p>