'dict_keys' object has no attribute 'tolist' code example
Example 1: 'dict_keys' object has no attribute 'tolist'
key, val = next(iter(my_dict.items()))
Example 2: 'dict_keys' object has no attribute 'tolist'
>>> test = {'foo': 'bar', 'hello': 'world'}
>>> list(test)
['foo', 'hello']
>>> list(test)[0]
'foo'