slice :=[]byte{'1','2','3','4','5','6'} a:= slice[0:3] fmt.Println(a) fmt.Println(slice[1])
输出结果[49 50 51] 50为什么结果回是:[49 50 51] 50 不应该是1,2,3,4 和 2吗?
byte 代表了 ASCII 码的一个字符slice里面是字符串返回的是ascii码
你在用bytes 显示 , 要用string(a) 来显示