开发者

help with Ruby's fastCSV, need to have empty comma locations

My CSV is like:

username, lastname, firstname, age, weight, location

If I don't have a value, I need to have just the comma with no data like:

blankman, man, blank,,,usa

Right now I have:

blankman, man, blank, '','',usa

Because I am doing this like:

users = U开发者_如何转开发ser.....


users.each { |user|

   age = ''


   csv << [ ...   ,age, ... ]


}

If I left the variable age uninitialized, then I got an error.

not sure what to do?


Try using age = nil.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜