我已经完成了向url发送请求并将它们保存在文件中的程序。该计划是这样的,并且可以正常使用:从命令行执行程序
require 'open-uri'
n = gets.to_i
out = gets.chomp
output = File.open(out, "w")
for i in 1..n
response = open('http://slowapi.com/delay/10').read
output << (response +"\n")
puts response
end
output.close
我想修改它,这样我可以从命令行执行它。我必须像这样运行:
fle --test abc -n 300 -f output
我该做什么?
我不明白你确切想要什么,但告诉你你可以使用'irb'来运行你的代码的每一行 –
英文写作时请使用英文标点符号。 – sawa