如下:
open("file_to_write.txt", "wb") do |file| open("http://www.ruby-lang.org/") do |uri| file.write(uri.read) end end
write & binary
oh i c. 谢谢,找了半天没找到点子上!
Write-only 和 Binary file mode
http://www.ruby-doc.org/core-1.9.3/IO.html
#3 楼 @artone 谢谢啦 好惭愧,都没想到去文档查~