I have two function which returns two dictionaries.
In third function I've tried merge these dictionaries using update
but I've got None
result while printing.
Could anyone explain my mistake?
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
I also tried this way:
def third():
a = first().copy()
return a.update(second())
By the way, this way doesn't work in Python 3.4:
def third():
return dict(a.items() + b.items())