Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. data = {'Author1': defaultdict(<class 'dict'>,
  2. {'Microsoft': 248,
  3. 'Ubuntu': 24,
  4. 'IOS': 24,
  5. 'Solaris': 24,
  6. 'C': 248}),
  7. 'Author2': defaultdict(<class 'dict'>,
  8. {'Microsoft': 38,
  9. 'Ubuntu': 38,
  10. 'IOS': 38,
  11. 'Go': 38,
  12. 'C': 38}),
  13. 'Author3': defaultdict(<class 'dict'>,
  14. {'Microsoft': 2,
  15. 'IOS': 2,
  16. 'Go': 2,
  17. 'C': 2})}
  18.  
  19. Name Microsoft Ubuntu IOS Go Solaris C
  20. Author1 248 24 24 0 24 248
  21. Author2 38 38 38 38 0 38
  22. Author3 2 0 2 2 0 2
  23.  
  24. html = '<table><tr><th>' + '</th><th>'.join(data.keys()) + '</th></tr>'
  25.  
  26. for row in zip(*data.values()):
  27. html += '<tr><td>' + '</td><td>'.join(row) + '</td></tr>'
  28.  
  29. html += '</table>'
  30.  
  31. print(html)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement