On 12/12/2013 5:49 PM, Amjad Syed wrote:
Hello,

I have 2 counters generated from list using  Collections.counter()

I want to print only key,values in Counter2 which have values > then 
corresponding value in Counter1.

E.g
Counter1={97:1,99:2,196:2,198:1}
Counter2={97:1 ,99:3, 196:1,198:1}

# Output
[99,3]
# Need to compare values of counter and reject in function/routine in value in 
counter2 is higher then value in counter1 for a current key

    [(k,Counter2[k]) for k in Counter2 - Counter1]

Counters are awesome.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to