learning scala read from file

scala读文件:

    example:

scala> import scala.io.Source
import scala.io.Source

scala> var inputFile = Source.fromFile("text.txt")
inputFile: scala.io.BufferedSource = non-empty iterator

scala> for ( line <- inputFile.getLines()) println(line)
hello panzidong
spark is good

scala> inputFile.close()

posted @ 2019-01-30 17:18  嵌入式实操  阅读(209)  评论(0编辑  收藏  举报