22
我有一个简单的脚本来完成一些搜索和替换。 这基本上是:Ruby - 如何用脚本输出编写一个新文件
File.open("us_cities.yml", "r+") do |file|
while line = file.gets
"do find a replace"
end
"Here I want to write to a new file"
end
正如你可以看到我想要写与输出的新文件。我怎样才能做到这一点?