I want to extract the dictionary keys, preserving their order (CTY, LC, DIV). When I perform a list comprehension, it is automatically ordering them.
columns = [key for key in dict_columns.keys()]
Any suggestions?
I want to extract the dictionary keys, preserving their order (CTY, LC, DIV). When I perform a list comprehension, it is automatically ordering them.
columns = [key for key in dict_columns.keys()]
Any suggestions?
consider using an OrderedDict to preserve the order of keys in your dict
https://docs.python.org/3.7/library/collections.html#collections.OrderedDict