智慧大石
func main() { m := map[int]int{ 1: 100, 2: 200, 3: 100, 4: 400, 6: 200, 7: 700, } mNew := make(map[int]int) for k, v := range m { if val, has := mNew[v]; !has { mNew[v] = k } else { fmt.Println(k, m[k], ",", val, m[val]) } }将映射键和值与新映射交换第二个映射不会插入重复键,因此您可以找到值