python函数调用后结果疑惑
def addDict(dict1,dict2): dict={} for k in dict1.keys(): dict[k]=dict1[k] for k in dict2.keys(): dict[k]=dict2[k] return dict
[root@RHEL6A scripts]# more py3.py #!/usr/bin/env pythondef addDict(dict1,dict2): dict={} for k in dict1.keys(): dict[k]=dict1[k] for k in dict2.keys(): dict[k]=dict2[k] return dictx={1:1}y={2:2}return1=addDict(x,y)print return1[root@RHEL6A scripts]# ./py3.py {1: 1, 2: 2}