「Ruby」open関数を使用してファイルを1行ずつ読み込む
構文
fp = open(“txtファイル名")
open関数を使用して、ファイルを1行ずつ読み込みます。
使用例
fp = open("test.txt")
fp.each do |line|
  p line
end
fp.close
Coding Changes the World
構文
fp = open(“txtファイル名")
open関数を使用して、ファイルを1行ずつ読み込みます。
使用例
fp = open("test.txt")
fp.each do |line|
  p line
end
fp.close