How to return dictionary keys as a list in Python?
This will convert the dict_keys object to a list: list(newdict.keys()) On the other hand, you should ask yourself whether or not it matters. It is Pythonic to assume duck typing — if it looks like a duck and it quacks like a duck, it is a duck. The dict_keys object can be iterated over just … Read more