我刚开始学习围棋,我决定通过做练习来学习https://github.com/gophercises/quiz
这就是我目前所拥有的
package main
import (
"encoding/csv"
"fmt"
"os"
)
func main() {
// Open the CSV file
file, err := os.Open("problems.csv")
if err != nil {
fmt.Println("Error:", err)
return
}
defer file.Close()
// Create a new CSV reader
reader := csv.NewReader(file)
// Read all the rows in the CSV file
rows, err := reader.ReadAll()
if err != nil {
fmt.Println("Error:", err)
return
}
}
当我运行它时,这是输出。
[[5+5 10] [1+1 2] [8+3 11] [1+2 3] [8+6 14] [3+1 4] [1+4 5] [5+1 6] [2+3 5] [3+3 6] [2+4 6] [5+2 7]]
很明显,返回的行是[][]string类型的,也就是字符串切片??? 这是第一次遇到这样的数据类型,我不确定要从哪些资源中学习。我问了chatgpt,现在更糊涂了。。。
有人可以向我解释这个过程吗?