From: Li Chen Date: 2008-07-17T22:38:49+09:00 Subject: Re: write multiple key/value to a row using cvs library Ikari Shinji wrote: > I tried this: > > require 'csv' > outfile = File.open('csvout','wb') > hash = {"a" => 100,"b" => 200,"c" => 300} > CSV::Writer.generate(outfile) do |csv| > csv << hash.to_a.flatten > end > > the result is : > a,100,b,200,c,300 Hi Ikari, Thank you for your help. I also came out with the same solution: to convert a hash into an array and so that each array will be write to the same row in csv. Li -- Posted via http://www.ruby-forum.com/.