simple question:the count of array

Jay O'Connor joconnor at cybermesa.com
Tue Jul 31 09:14:06 EDT 2001


sdf wrote:
> 
> >>> a=['a','b','c']
> >>> b=a.count()
> Traceback (most recent call last):
>   File "<pyshell#9>", line 1, in ?
>     b=a.count()
> TypeError: count() takes exactly 1 argument (0 given)
> >>>
> 
> then how I get the number of a,I mean how much
> values in a,in this case it should be 3
> _________________________________________


I'm not sure what "count()" does, but to get the number of values in an
array, use len()

b = len (a)

b is now 3

-- 
Jay O'Connor
joconnor at cybermesa.com
http://www.cybermesa.com/~joconnor



More information about the Python-list mailing list