Skip to content

Instantly share code, notes, and snippets.

@bkamapantula
Created October 26, 2011 02:47
Show Gist options
  • Save bkamapantula/1315267 to your computer and use it in GitHub Desktop.
Save bkamapantula/1315267 to your computer and use it in GitHub Desktop.
Reading files with two columns in Ruby - Day 5
# read file with two columns in Ruby
input_file = File.new("2columns.txt", "r")
while(line = input_file.gets)
col1, col2 = line.split(' ')
puts col1
puts col2
end
input_file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment