title: How to merge elements from multiple lists with same ID in Python?
body: <p>I have a text file with 670,000 + lines need to process.
  Each line has the format of:</p>
  
  <p><code>uid, a, b, c, d, x, y, x1, y1, t, 0,</code></p>
  
  <p>I did some cleanning and transferred each line to a list:</p>
  
  <p><code>[uid,(x,y,t)]</code></p>
  
  <p>And my question is: How can I merge (x,y,t)tuples in different lists but have the common uid efficiently?</p>
  
  <p>For example:
  I have multiple lists</p>
  
  <pre><code>[uid1,(x1,y1,t1)]
  [uid1,(x2,y2,t2)]
  [uid2,(x3,y3,t3)]
  [uid3,(x4,y4,t4)]
  [uid2,(x5,y5,t5)]
  ......
  </code></pre>
  
  <p>And I want to transfer them into:</p>
  
  <pre><code>[uid1,(x1,y1,t1), (x2,y2,z2)]
  [uid2,(x3,y3,t3), (x5,52,z5)]
  [uid3,(x4,y4,t4)]
  ......
  </code></pre>
  
  <p>Any help would be really appreciated.</p>