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()

上一篇:windows cmd 命令大全


下一篇:Scala Control Structures