>>> len(x._toc) 2 >>> len(x._toc["root"]) 3 >>> len(x._toc["irc-clients"]) 1 tot = 0 for i in x._toc: tot = tot+len(i)