count key in dictionary python code example Example: how many keys in a dictionary python > a = {'foo':42, 'bar':69} > len(a) 2