Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data = {'Author1': defaultdict(<class 'dict'>,
- {'Microsoft': 248,
- 'Ubuntu': 24,
- 'IOS': 24,
- 'Solaris': 24,
- 'C': 248}),
- 'Author2': defaultdict(<class 'dict'>,
- {'Microsoft': 38,
- 'Ubuntu': 38,
- 'IOS': 38,
- 'Go': 38,
- 'C': 38}),
- 'Author3': defaultdict(<class 'dict'>,
- {'Microsoft': 2,
- 'IOS': 2,
- 'Go': 2,
- 'C': 2})}
- 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
- html = '<table><tr><th>' + '</th><th>'.join(data.keys()) + '</th></tr>'
- for row in zip(*data.values()):
- html += '<tr><td>' + '</td><td>'.join(row) + '</td></tr>'
- html += '</table>'
- print(html)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement