PDA

View Full Version : Python, how to find total number of items in a list



tc101
July 28th, 2007, 03:22 AM
Say I have a simple list:

a = ["a","b","c"]

I can get the number of any item in it with

a.count("b")
which gives 1

But how do I get the total number of items in the list, which would be 3?

Occasionally Correct
July 28th, 2007, 03:56 AM
size = len(a)

:)