所以我有,
fo = {'current': [[1,23],[3,45],[5,65]]}
pl = {'current': [(2,30),(3,33),(5,34)]}
total = {}
for i in fo,pl:
for j in i:
if total.get(j):
total[j] += i[j]
else:
total[j] = i[j]
所以,我预计,
total = {'current': [[1,23],[3,45],[5,65],(2,30),(3,33),(5,34)]}.
我知道这是合并列表和元组。
But why does, fo = {'current': [[1,23],[3,45],[5,65],(2,30),(3,33),(5,34)]} ??
有什么提示吗?合并列表和元组有问题吗?我认为,两者都是列表,列表是可变的,而元组不是。这是唯一的区别。