我已经编写了代码,但它不会工作。代码是:
#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 文本文件?