2019-12-07から1日間の記事一覧
お題 次のファイルの行数を取得せよ。 test test test test test ファイル名test_file.rb (ファイル場所は実行ファイルと同一ディレクトリにあるものとする) 回答 str = File.read("./test_file.rb") p str.lines.count 説明 ファイルの内容を取得する方法…
お題 次のファイルの行数を取得せよ。 test test test test test ファイル名test_file.rb (ファイル場所は実行ファイルと同一ディレクトリにあるものとする) 回答 str = File.read("./test_file.rb") p str.lines.count 説明 ファイルの内容を取得する方法…