标签:完成 import main style div 遍历 apn col 使用
map 的遍历过程使用 for range 循环完成,代码如下:
package main import "fmt" func main() { mapNum := make(map[string]int) mapNum["key1"] = 1 mapNum["key2"] = 2 mapNum["key3"] = 3 mapNum["key4"] = 4 //输出map集合key和value for k, v := range mapNum { fmt.Printf("key:%s value:%d \n", k, v) } //只输出value for _, v := range mapNum { fmt.Printf(" value:%d \n", v) } //只输出key for k := range mapNum { fmt.Printf("key:%s \n", k) } }
标签:完成 import main style div 遍历 apn col 使用
原文地址:https://www.cnblogs.com/personblog/p/12254679.html