类似其他语言的字典
package main
import (
"fmt"
)
func main() {
//第一种
var m map[string]string
m = map[string]string{}
m["name"] = "zhangsan"
m["sex"] = "男"
fmt.Println(m)
//第二种 常用
m1 := map[string]string{}
m1["name"] = "李四"
m1["sex"] = "女"
fmt.Println(m1)
//第三种
m2 := make(map[string]string)
m2["name"] = "王五"
m2["sex"] = "男"
fmt.Println(m2)
//删除m2的name key
delete(m2,"name")
fmt.Println(m2)
//循环map
for k,v := range m1{
fmt.Println(k,v)
}
}