require 'CSV' CSV.open('data.csv','w') do |data| data<<['name','ext','room'] data<<['AI','123','1'] data<<['AI','123','1'] end *:在ruby187中可以并已通过测试.