f = File.open("./data.txt","a") for i in 1..50 f.write("$game_variables[#{i}] = " + $game_variables.to_s + "\n") end f.close
"w": 以写入模式打开文件。打开文件时,若文件已存在就清空文件内容。 "a": 以写入模式打开文件。通常把写入内容添加到文件结尾。