我試圖在文件夾中查找文件的內(nèi)容,所以我列出了文件夾中的內(nèi)容,然后在循環(huán)遍歷它時我試圖讀取文件。files, _ := ioutil.ReadDir("documents/")for _, f := range files { //fmt.Println(f.Name()) z := "documents/" + f.Name() fmt.Println(z) // prints out 'documents/*doc name*' recursively z, err := ioutil.ReadFile(z) // This line throws up the error我得到的錯誤是: test.go:85: 無法在多重賦值中將 []byte 分配給 z(類型字符串)。
- 1 回答
- 0 關(guān)注
- 316 瀏覽
添加回答
舉報
0/150
提交
取消