I have a dictionary of the form {0: -1.0, 21: 2.23, 7: 7.1, 46: -12.0}
.
How can I turn this into {'p0': -1.0, 'p21': 2.23, 'p7': 7.1, 'p46': -12.0}
efficiently i.e:
without a for loop and something like dict[key[i]] = dict.pop("p"+str(key[i]))
?