I have a dictionary that looks like the below.
ex1_pattern = {'ex':0,'country':1,'dow':2,'hod':3,'adx':4,'vid1':5}
I would like to create a lists of the keys eg
ex1_pattern.keys()
but..I would like the list to be in the order of the ranks. eg:
[ex,country,dow,hod,adx,vid1]
What is the most time efficient means to do that?
sorted(ex1_pattern, key=ex1_pattern.get)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.