Skip to content

Instantly share code, notes, and snippets.

@liwh
Created November 17, 2010 06:02
Show Gist options
  • Save liwh/703047 to your computer and use it in GitHub Desktop.
Save liwh/703047 to your computer and use it in GitHub Desktop.
ruby写文件
#1
file= File.new('filename','w')
file.puts 'aa'
file.close
#2
File.open('filename','w') do |file|
file.puts 'aa'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment