在文件中添加新行?


97

我想在插入字符串后添加新行。

我当前的代码如下所示:

  File.open(filename, 'a') do |file|
    file.write @string
  end

插入字符串后如何添加新行?

Answers:



By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.