Skip to content

Instantly share code, notes, and snippets.

@adilw3nomad
Last active June 22, 2019 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adilw3nomad/c1d4758eb43e32289d4b4ff895034477 to your computer and use it in GitHub Desktop.
Save adilw3nomad/c1d4758eb43e32289d4b4ff895034477 to your computer and use it in GitHub Desktop.
package main
import (
"encoding/csv"
"fmt"
"log"
"os"
)
func main() {
csvFile, err := os.Open("problems.csv")
if err != nil {
log.Fatal(err)
}
defer csvFile.Close()
reader := csv.NewReader(csvFile)
records, err := reader.ReadAll()
if err != nil {
log.Fatal(err)
}
for i := range records {
fmt.Println("Question: ", records[i][0])
fmt.Println("Answer: ", records[i][1])
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment