Identify and perform actions to data within stated limits

Peter Hansen peter at engcorp.com
Tue Mar 1 19:57:38 EST 2005


dasacc at gmail.com wrote:
> I found out that doing a re.findall will split up the results into an
> array, or rather something called a list (looks like an array to me).

It may look like an array to you, but it's a list.  Python
doesn't have arrays, unless you count something like the
numarray/Numeric extension module.  (You probably just meant
that Python's list looks like the sort of object you've known
as an "array" in other languages.  If that's the case,
fine, but call it a list when you're working with Python
to avoid confusion.)

> I'd be set if i could just count the elements in the array but I can't
> seem to find anything in the documentation on how to : /  ...

somelist = [1, 2, 3, 4]
print len(somelist)

This will print "4", which is a count of the elements in the list.
Is that what you wanted?  If not, please clarify.

-Peter



More information about the Python-list mailing list