>>> dct = { ... "1": "a", ... "3": "b", ... "8": { ... "12": "c", ... "25": "d" ... } ... } >>> >>> dct.keys() ['1', '8', '3'] >>> for key in dct.keys(): print key ... 1 8 3 >>>