Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 读取CSV中的每一行并使用它查询API_Ruby_Csv - Fatal编程技术网

Ruby 读取CSV中的每一行并使用它查询API

Ruby 读取CSV中的每一行并使用它查询API,ruby,csv,Ruby,Csv,我有以下Ruby代码: require 'octokit.rb' require 'csv.rb' CSV.foreach("actors.csv") do |row| CSV.open("node_attributes.csv", "wb") do |csv| csv << [Octokit.user "userid"] end end 需要“octokit.rb” 需要“csv.rb” CSV.foreach(“actors.CSV”)do|行| CSV.op

我有以下Ruby代码:

require 'octokit.rb'
require 'csv.rb'

CSV.foreach("actors.csv") do |row|
  CSV.open("node_attributes.csv", "wb") do |csv|
    csv << [Octokit.user "userid"]
  end
end
需要“octokit.rb”
需要“csv.rb”
CSV.foreach(“actors.CSV”)do|行|
CSV.open(“node_attributes.CSV”、“wb”)do | CSV|
csv
您可以通过调用

holder[0][0]
=> data in the array 
holder[1][0] 
=> moar data in array
有道理吗

#make this a loop
profile = []
profile[0] = holder[0][0]
profile[1] = holder[1][0]
profile[2] = 'whatever it is you want to store in the new cell'

CSV.open(DOD, "a") do |data|
data << profile.map
end

#end the loop here
#让这成为一个循环
配置文件=[]
个人资料[0]=持有人[0][0]
个人资料[1]=持有人[1][0]
profile[2]=“无论您想在新单元格中存储什么”
CSV.open(国防部,“a”)do |数据|

数据谁投票关闭可以帮助我理解为什么?如果能提供指导,我很乐意改进这个问题。
#make this a loop
profile = []
profile[0] = holder[0][0]
profile[1] = holder[1][0]
profile[2] = 'whatever it is you want to store in the new cell'

CSV.open(DOD, "a") do |data|
data << profile.map
end

#end the loop here