For a dictionary as follows:
my_dict={'name':'Stack', 'age':11}
print('Name is {name} and age is {age}.'.format(**my_dict))
#output# Name is Stack and age is 11
However, if keys are integers in a dictionary, how should I unpack the dictionary, for example:
new_dict={1:'Stack', 2:'over', 3:'flow'}
print('1 is {1} and 2 is {2} and 3 is {3}'.format(**new_dict))
#output error# tuple index out of range
In this case, how can I get result as follows:
1 is Stack and 2 is over and 3 is flow
I know one can do it with many other ways, but is it possible to use the same strategy in the first example. Thank you.