How to get the number of times the specific item appears in a list with Python

1 Answer

0 votes
lst = ['a', 'b', 'c', 'b', 'e', 'b', 'g'];

c = lst.count('b')

print(lst)
print(c)


    
'''
run:
    
['a', 'b', 'c', 'b', 'e', 'b', 'g']
3

'''
  

 



answered Jun 24, 2020 by avibootz
...