tmp = {}
對於x中的v:
tmp[v[0]] = tmp.get(v[0])和tmp[v[0]] + v[1]或v[1]
x= [ [k,v] for (k,v in tmp . items()]
打印(x)
輸出:
[['北京',3],['福建',1],['天津',1]]