开发者

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

开发者 https://www.devze.com 2023-01-23 15:16 出处:网络
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:

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

精彩评论

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