a = {0: 'PtpMotion', 1: 'PtpMotion', 2: 'LinMotion', 3: 'LinMotion', 4: 'LinMotion', 5: 'LinMotion', 6: 'LinMotion', 7: 'LinMotion', 8: 'LinMotion', 9: 'PtpMotion', 10: 'LinMotion', 11: 'Wait'}
b = {}
for key, val in a.items():
b[val] = key
print b
What I am trying to do is to swap value of the dictionary for key. But using this code, I lose some information of the dictionary, getting this output:
{'LinMotion': 10, 'PtpMotion': 9, 'Wait': 11}
Why does it happen?