Ruby--CSV

1. 解析CSV:

(1)读取文件:csv = CSV.read("#{Rails.root}/public/data/statecountycity.csv", :headers => true, :header_converters => lambda{|h| h.strip})

(2)遍历:csv.each do |row| {c_row = row.to_hash ......}

原文地址:https://www.cnblogs.com/gary-tao/p/5888415.html