conv json to xml
#!/usr/bin/python3 | |
# Source: https://github.com/quandyfactory/dicttoxml/blob/master/README.markdown | |
# page = urllib.urlopen('http://quandyfactory.com/api/example') | |
import json | |
import urllib | |
import dicttoxml | |
import sys | |
if (len(sys.argv) > 1): | |
page = open(sys.argv[1]) | |
else: | |
#page = open('/home/$USER/tmp/db_out.json') | |
page = open('/tmp/db_out.json') | |
content = page.read() | |
obj = json.loads(content) | |
print(obj) | |
xml = dicttoxml.dicttoxml(obj) | |
print(xml) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment