This file contains hidden or 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
#!/usr/bin/env python | |
import sys | |
import yaml | |
import pprint | |
filename = sys.argv[1] | |
y = yaml.safe_load(open(filename, 'r')) |
This file contains hidden or 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 'nokogiri' | |
doc = Nokogiri.XML DATA | |
class Hasify | |
def convert node | |
return node.text if node.text? | |
{ node.name => node.children.map { |x| convert x } } | |
end |