I have a list of lists such as : [[foo,1],[baz,1],[foo,0],[bar,3],[foo,1],[bar,2],[baz,2]]. I want to get all the different items in the inner lists and find the total number of them. I mean the result should be like : [[foo,2],[bar,5],[baz,3]]. How can I do this task?

Thanks in advance.

You might want to use Counter

Using Counter looks good, but it will work only with python >= 2.7. The problem with your question is that there is no python code. Hint: start with a program which prints each list item on a different line.

(Default)Dictionary accessed by the first value could be good place to collet the values... Go ahead and show us your code.