ark at acm.org
Wed Jan 12 19:07:47 CET 2005
"It's me" <itsme at yahoo.com> wrote in message
news:ukdFd.10645$5R.2000 at newssvr21.news.prodigy.com...
> What's the best way to count number of items in a list?
> For instance,
> I want to know how many items are there in a (answer should be 7 - I don't
> want it to be 4)
How about this?
if isinstance(x, (list, tuple, dict)):
return sum(map(totallen, x))
More information about the Python-list