When I do:
d = {'x': 1, 'y': 2, 'z': 'randy'}
print(d.keys())
The result is:
dict_keys(['x', 'y', 'z'])
Why is there the dict_keys
? Is there a way to get rid of it?
When I do:
d = {'x': 1, 'y': 2, 'z': 'randy'}
print(d.keys())
The result is:
dict_keys(['x', 'y', 'z'])
Why is there the dict_keys
? Is there a way to get rid of it?
Convert it to a list.
>>> print(list(d.keys()))
['z', 'x', 'y']