我想阅读一个csv行,更新一个字段,然后再用引号输出行。红宝石阅读和写入CSV与行情
Row Example Input => "Joe", "Blow", "[email protected]"
Desired Row Example Output => "Joe", "Blow", "[email protected]"
My script below outputs => Joe, Blow, [email protected]
它丢失了我想保留的双引号。
我已经尝试过各种选择,但目前为止没有喜悦..任何提示?
非常感谢!
require 'csv'
CSV.foreach('transactions.csv',
:quote_char=>'"',
:col_sep =>",",
:headers => true,
:header_converters => :symbol) do |row|
row[:customer_email] = '[email protected]'
puts row
end
你想添加引号,如果有摆在首位有没有?或者你会一直有报价进来? –
行情是在那里摆在首位。 –