0

As of now I can append the key values of a dictionary to an empty list, but the goal is to print them in order of the keys in the dictionary.

Here's what I have so far:

DATA = {'Temp1':1, 'Temp2':2, 'RPM1':3, 'RPM2':4, 'Depth1':5, 'Depth2':6, 'A1':7, 'A2':8, 
'KWH1':9, 'KWH2':10, 'V1':11, 'V2':12}

vals = []

for value in DATA.itervalues():
    vals.append(value)

print vals

So I want to print the key value of 'Temp1', 'Temp2', 'RPM1', etc. in the specific order they're listed in the dictionary.

sshashank124
  • 31,495
  • 9
  • 67
  • 76

0 Answers0