Skip to content

Instantly share code, notes, and snippets.

@Andrelton
Created June 1, 2015 03:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andrelton/fdfdd728007f46922fdc to your computer and use it in GitHub Desktop.
Save Andrelton/fdfdd728007f46922fdc to your computer and use it in GitHub Desktop.
require 'csv'
friends = []
File.open("hamburgler.txt", 'r') do |f|
f.each_line { |line| friends << line.chomp }
end
p friends
File.open("helicopter.txt", 'w') do |f|
friends.each do |item|
f.print item + " likes "
end
end
# CSV.foreach(filename, headers: true, header_converters: :symbol ) do |row|
# recipes << Hash[row]
# end
CSV.open("applesauce.csv", 'w') do |csv|
csv << friends
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment