i have file on stored informations, eg.
0,0,0.0,0.00266920744152335,0.0,0.0,0.0 1,0.0,0.0,0.9385656429557993,1.0,0.0,0.0,0 1,0.0,0.0,0.9385656429557993,1.0,0.0,0.0,0 1,0.0,0.0,0.9385656429557993,1.0,0.0,0.0,0 0,0,0.0,0.00266920744152335,0.0,0.0,0.0 ... i create 2 more files on want split informations stored in textlines
val textlines = scala.io.source.fromfile("data/sample/textfile.txt") val first = new java.io.printwriter("data/sample/first.txt") val second = new java.io.printwriter("data/sample/second.txt") (line <- textlines.getlines()) { val row = line.split(",") if (row(0).equals("0")) first.println(line) if (row(0).equals("1")) second.println(line) } first.close() second.close() textlines.close() the first file written well, second file remains blank.
what's wrong?
i don't know why cleaning project resolve issue.
Comments
Post a Comment