fork download
  1. datas = [
  2. (
  3. ['a','b','c'],
  4. ['1','2','3']
  5. ),
  6. (
  7. ['b','c'],
  8. ['4','5']
  9. ),
  10. (
  11. ['a'],
  12. ['6']
  13. )
  14. ]
  15.  
  16. count_table = {}
  17.  
  18. for data in datas:
  19. for tag, count in zip(*data):
  20. if tag not in count_table:
  21. count_table[tag] = 0
  22. count_table[tag] += int(count)
  23.  
  24. print(list(count_table.keys()))
  25. print(list(map(str, count_table.values())))
  26.  
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
['b', 'a', 'c']
['6', '7', '8']