python 初学 字典

empty_dict={}
a_dict={'one':1,'two':2,'three':3}
print ("{}".format(a_dict))
#reverse output!!!
#print ("{!s}".format(len(a_dict)))
#print ("{}".format(a_dict['two']))
a_new_dict=a_dict.copy()
print ("{!s}".format(a_new_dict))
a_new1_dict=a_dict.copy()
print("{!s}".format(a_new1_dict))
a_new2_dict=a_dict.copy()
print("{!s}".format(a_new2_dict))
#output order!!!

为什么对a_dict的copy输出顺序与a_dict不同,而且a_dict本身输出也不是他本来的顺序?

猜你喜欢

转载自www.cnblogs.com/ryan-l/p/9955652.html