Imagine I have a dict like this:
d = {'key': 'value'}
The dict contains only one key value.
I am trying to get key from this dict, I tried d.keys()[0] but it returns IndexError, I tried this:
list(d.keys())[0]
It works just fine but I think it is not a good way of doing this because it creates a new list and then get it first index.
Is there a better way to do this? I want to get the value too.