1、声明类型
golang:counts := make(map[string]int)
// python 不用声明类型
python:counts = {}
2、赋值
golang:counts["age"] = 1
python:counts["age"] = 1
3、遍历
golang:
for key, value := range counts {
fmt.Println(key, value)
}
python:
for key, value in counts.items():
print key, value
有疑问加站长微信联系(非本文作者)