The keys () method of the dictionary object returns a list of all the keys used in the dictionary in random order (if you want it sorted, just apply the sorted () function to it). To check if one key is in the dictionary, use the keyword.
The order of the keys in is dict()not defined (depending on which Python implementation you are using). To iterate through a dict in an ordered manner:
my_dict = {'a': 10, 'b': 20, 'c': 30}
for key in sorted(my_dict.keys()):
print key, my_dict[key]
:
a 10
b 20
c 30
, , , dict() - , , . , . SO