You can use .keys() :
for key in your_dict.keys(): print key
or just iterate over the dictionary:
for key in your_dict: print key
Please note that the dictionaries are not ordered. The keys you received will come out in a somewhat random order:
['Wonderland', 'ALice', 'in']
If you care about the order, the solution will be to use lists that are ordered:
sort_of_dict = [('ALice', 1), ('in', 2), ('Wonderland', 3)] for key, value in sort_of_dict: print key
Now you will get the desired results:
>>> sort_of_dict = [('ALice', 1), ('in', 2), ('Wonderland', 3)] >>> >>> for key, value in sort_of_dict: ... print key ... ALice in Wonderland
Blender
source share