title: Python dynamic dictionary + print html output
body: <p>I am performing computation on complex query and getting below  dictionary as final output and now want to print that dict in html format  without hardcoding column names as it is dynamic.</p>
  
  <p>If column is not there then add 0 in the report.</p>
  
  <pre><code>data = {'Author1': defaultdict(&lt;class 'dict'&gt;,
                          {'Microsoft': 248,
                           'Ubuntu': 24,
                           'IOS': 24,
                           'Solaris': 24,
                           'C': 248}),
   'Author2': defaultdict(&lt;class 'dict'&gt;,
                             {'Microsoft': 38,
                              'Ubuntu': 38,
                              'IOS': 38,
                              'Go': 38,
                              'C': 38}),
   'Author3': defaultdict(&lt;class 'dict'&gt;,
                      {'Microsoft': 2,
                       'IOS': 2,
                       'Go': 2,
                       'C': 2})}
  </code></pre>
  
  <p>Output</p>
  
  <pre><code> Name       Microsoft  Ubuntu IOS Go Solaris C
  Author1       248        24   24  0   24     248  
  Author2        38        38    38 38   0      38
  Author3        2         0     2  2    0      2
  </code></pre>
  
  <p>code: </p>
  
  <pre><code>html = '&lt;table&gt;&lt;tr&gt;&lt;th&gt;' + '&lt;/th&gt;&lt;th&gt;'.join(data.keys()) + '&lt;/th&gt;&lt;/tr&gt;'
  
  for row in zip(*data.values()):
      html += '&lt;tr&gt;&lt;td&gt;' + '&lt;/td&gt;&lt;td&gt;'.join(row) + '&lt;/td&gt;&lt;/tr&gt;'
  
  html += '&lt;/table&gt;'
  
  print(html)
  </code></pre>
  
  <p>This code errors out bec of default dict inside a dictionary, which needs to be removed.</p>