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 ......}

posted @ 2016-09-20 13:07  盖瑞  阅读(163)  评论(0编辑  收藏  举报