Created
March 4, 2010 20:21
-
-
Save sgoodwin/322070 to your computer and use it in GitHub Desktop.
CSV -> Plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'CSV' | |
require 'plist' | |
file = File.open('somecsv.csv') | |
list = CSV.parse(file.read) | |
1.upto(list.count) do |row| | |
if(!list[row].nil?) | |
hash[list[row][0]] = list[row][1] | |
end | |
end | |
doc = hash.to_plist | |
local_filename = "output.plist" | |
File.open(local_filename, 'w') {|f| f.write(doc) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment