title: Generating HTML Tables from Tuple Python
body: <p>I have a tuple list of individuals. I would like to generate a HTML table for each person. I'm sure there is a simple way of doing this, but I dont know what that would be. I put together some code that I think is close, but probably not an efficient way of doing it.</p>
  
  <p>Desired Output:</p>
  
  <pre><code>&lt;html&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;Andrew&lt;/td&gt;&lt;td&gt;10&lt;/td&gt;&lt;td&gt;20&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Andrew&lt;/td&gt;&lt;td&gt;54&lt;/td&gt;&lt;td&gt;56&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;20&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;Jim&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;15&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;table&gt;
  &lt;tr&gt;&lt;td&gt;Sarah&lt;/td&gt;&lt;td&gt;30&lt;/td&gt;&lt;td&gt;43&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>My Code:</p>
  
  <pre><code>mytuple = [('Andrew','10','20'),('Jim',"20",'12'),("Sarah","30",'43'),("Jim","23",'15'),("Andrew","54",'56')]
  mytuple = sorted(mytuple)
  FULL_HTML = ""
  
  for row in mytuple:
       individual_count =  mytuple.count(row[0])
       print individual_count
  
       for row1 in xrange(row, row + individual_count):
          HTML_BODY "&lt;tr&gt;&lt;td&gt;" + row1[0] + "&lt;/td&gt;&lt;td&gt;" + row1[1] + "&lt;/td&gt;&lt;td&gt;" + row1[2] + "&lt;/td&gt;&lt;td&gt;&lt;/tr&gt;\n"
  
       FULL_HTML = "&lt;table&gt;\n" _ FULL_HTML + HTML_BODY +"\n&lt;/table&gt;\n"
  
  FULL_HTML = "&lt;html&gt;\n" + FULL_HTML + "\n&lt;/html&gt;"
  
  print FULL_HTML
  </code></pre>