>>> len(x._toc) 2 >>> len(x._toc["root"]) 3 >>> len(x._toc["irc-clients"]) 1 # So, x._toc is some kind of dict or dict-like object. # And apparently its values are all lists. # We want to see how many items are in those lists, combined. tot = 0 for key,value in x._toc.iteritems(): tot = tot+len(value)