标签:err fun string 文件的 content pre nil == code
package main import ( "fmt" "io/ioutil" ) func main() { //读入制定文件的全部数据,返回[]byte类型的原始数据 bytes, err := ioutil.ReadFile("C:/Users/Administrator/Desktop/eth地址.txt") if err == nil { //使用string强制转化为字符串 content := string(bytes) fmt.Println(content) }else { fmt.Println("文件读入失败,err=",err) } }
标签:err fun string 文件的 content pre nil == code
原文地址:https://www.cnblogs.com/paad/p/11115832.html