Counting the number of elements in a list - help.

Bryce C. Mason bmason at rand.org
Tue Apr 16 15:33:12 EDT 2002


I need to know these things; may someone help me out?

1) a function which returns the number of elements in a list
2) a function which takes a list and an index and returns a zero when that
list index is out of range.

I want to continue appending things to a list until the list reaches a
specific size.  For example:

while (list_size(list)<10):
    list.append("something")

anyone know of a "list size" function?  It has to be out there..hehe, i'm
just really green at python.  If I knew #2, I could build the function
myself, but #1 is preferable.

Help!

Bryce





More information about the Python-list mailing list