Keys from dictionary into list and maintain position

You can use a list comprehension:

orderedDict = {'C': 2, 'A': 3, 'B': 3}
orderedList = [key for key in orderedDict.keys()]

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top