package main import ( "fmt" "strconv" ) func main() { // 把字符串转换为数字 str := "10000" ret1, err := strconv.ParseInt(str, 10, 64) if err != nil { fmt.Printf("paresint failed, err:%v", err) return } fmt.Printf("%#v %Tn", ret1, ret1) // 把数字转换为字符串 i := int32(97) ret2 := fmt.Sprintf("%d", i) fmt.Printf("%#v", ret2) }