golang map getkeys

golang 获取map的keys

package main

import "fmt"
import "reflect"

func main() {
    abc := map[string]int{
        "a": 1,
        "b": 2,
        "c": 3,
    }

    keys := reflect.ValueOf(abc).MapKeys()

    fmt.Println(keys) // [a b c]
}
原文地址:https://www.cnblogs.com/lavin/p/6038552.html