How to get the name of keys out of the map?

I am reading data from the file and saving that data into the map, so is there a way that I can print out only the name of keys out of the map?

Thank you,

you can use range over the map

kvs := map[string]string{"a": "apple", "b": "banana"}
for k, v := range kvs {
    fmt.Printf("%s -> %s\n", k, v)
}
1 Like

yeah that’s what I ended up doing. Thank you for help tho