I\'m trying to access a dict_key\'s element by its index:
test = {\'foo\': \'bar\', \'hello\': \'world\'} keys = test.keys() # dict_keys object keys.index(
Try this
keys = [next(iter(x.keys())) for x in test] print(list(keys))
The result looks like this. ['foo', 'hello']
You can find more possible solutions here.