>>> a = [1,1,1,1,2,2,2,2,3,3,4,5,5] >>> d = {x:a.count(x) for x in a} >>> d {1: 4, 2: 4, 3: 2, 4: 1, 5: 2} >>> a, b = d.keys(), d.values() >>> a [1, 2, 3, 4, 5] >>> b [4, 4, 2, 1, 2]