Reputation: 22113
I have a dict
dt = {'condition': ['isabs', 'isdir', 'isfile', 'islink', 'ismount'],
'expand': ['expanduser', 'expandvars'],
'get': ['getatime', 'getctime', 'getmtime', 'getsize']}
to count its elements. I define a function
def count_nested_list(dt):
i = 0
for value in dt.values():
for j in value:
i += 1
return i
alternatively can use len(dt(0) + len(dt1) + len(dt2)
How to solve the problem in one line?
Upvotes: 0
Views: 530