我有两个函数,它返回两个字典。
在第三个函数中,我尝试使用update
合并这些字典,但是在打印时得到了None
的结果。
有人能解释一下我的错误吗?在
def first():
dict1 = {
one : [1, 2, 3]
}
return dict1
def second():
dict2 = {
two : [3, 4, 5]
}
return dict2
def third():
return first().update(second)
print(third())
>>> None
我也试过这样做:
^{pr2}$顺便说一下,这种方法在Python 3.4中不起作用:
^{3}$
稍作修改的版本:
相关问题 更多 >
编程相关推荐