2
我已经编写代码,但它不会工作。代码是:如何在Ruby中将字符串保存为CSV文件?
#Parse and print the Tweet if the response code was 200
tweets = nil
if response.code == '200' then
tweets = JSON.parse(response.body)
require 'csv'
CSV.open("trial.csv", "ab") do |csv|
csv << ["text", "created_at", "name", 'id']
csv << ["tweets"]
end
end
如何更改此代码以将推文保存到CSV文本文件?
您是否尝试过使用Google搜索? –
我正在认真对抗因为缺乏努力而失败的冲动。该死的,我敢肯定现在有人会这样做,我已经把它放在那里。 –