package main

import (
    "bufio"
    "fmt"
    "os"
)

func printFile(filename string) {
    file, err := os.Open(filename)
    if err != nil {
        panic((err))
    }

    scanner := bufio.NewScanner(file)
    for scanner.Scan() {
        fmt.Println(scanner.Text())
    }
}

func main() {

    printFile("hello.go")

}

 

相关文章:

  • 2022-12-23
  • 2021-08-06
  • 2021-08-12
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-05
  • 2022-01-09
  • 2021-12-13
  • 2021-11-25
  • 2021-06-27
  • 2022-03-07
相关资源
相似解决方案