LoginSignup
1
1

More than 5 years have passed since last update.

textを1行ごとに分けてListにする方法

Last updated at Posted at 2017-07-18

コード

sample0719.scala
object sample0719 {
  def main(args: Array[String]): Unit = {
    val bufferedSource = io.Source.fromFile("resources/textList.csv")
    var lists = bufferedSource.getLines.toList
    println(lists)
  }
}

csv

textList.csv
test1
test2
test3
test4

terminal

List(test1, test2, test3, test4)
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1