如果我有一个地图m是有更好的方法得到一个值的v片
原文链接:https://www.f2er.com/go/187717.htmlpackage main import ( "fmt" ) func main() { m := make(map[int]string) m[1] = "a" m[2] = "b" m[3] = "c" m[4] = "d" // Can this be done better? v := make([]string,len(m),len(m)) idx := 0 for _,value := range m { v[idx] = value idx++ } fmt.Println(v) }