Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options = {:encoding => 'UTF-8', :skip_blanks => true}
- CSV.foreach("data.csv", options, ) do |row, i|
- puts i
- end
- require 'csv'
- CSV.foreach('test.csv') do |csv|
- puts $.
- end
- Year,Make,Model,Description,Price
- 1997,Ford,E350,"ac, abs, moon",3000.00
- 1999,Chevy,"Venture ""Extended Edition""","",4900.00
- 1999,Chevy,"Venture ""Extended Edition, Very Large""","",5000.00
- 1996,Jeep,Grand Cherokee,"MUST SELL!nair, moon roof, loaded",4799.00
- 1
- 2
- 3
- 4
- 5
- require 'english'
- puts $INPUT_LINE_NUMBER
- options = {:encoding => 'UTF-8', :skip_blanks => true}
- CSV.read("data.csv", options).each_with_index do |row, i|
- puts i
- end
- options = {:encoding => 'UTF-8', :skip_blanks => true}
- i = 0
- CSV.foreach("data.csv", options) do | row |
- puts i
- i += 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement