Python 3
    Python 3 - Overview
    Python 3 - Install
    Python 3 - REPL
    Python 3 - RegEx
    Python 3 - List
    Python 3 - XML/YAML
    Python 3 - DateTime
    Python 3 - Subprocess
    Python 3 - pickle
    Python 3 - env
    Python 3 - lib
    Python 3 - Trouble Shooting
    Python 2 to 3

Python 3 - XML/YAML

Updated: 2021-11-19

YAML

yaml module can be used to easily read or write yaml files.

Install

$ pip install yaml

Import

>>> import yaml

Read from File

>>> yaml.load(open("test.yml"))

Write to File

>>> yaml.dump(obj)

XML

Convert XML to JSON

Install xmltodict

$ sudo pip install xmltodict

Python Code:

import json
import xmltodict

s = open("foo.xml").read()
d = xmltodict.parse(s)
json.dump(d, open("bar.json",'w'))