Monday, 15 April 2013

count number of occurences in list python -



count number of occurences in list python -

this question has reply here:

how can count occurrences of list item in python? 10 answers

i have set contains possible values nowadays in list. want know how much of each value nowadays in list.

so, have:

set_a = ("a","b", "c", "d") lst = ["a", "b", "c", "c"]

what want this:

a 1 b 1 c 2

you see solutions here: how can count occurrences of list item in python?

for instance can do:

[1, 2, 3, 4, 1, 4, 1].count(1)

python

No comments:

Post a Comment