YAML Ain’t Markup Language

I am studying for my Cisco CCNA. As a self-taught Python programmer and currently learning about SDN, I read about ‘YAML’ in an O’Reilly book I recently picked up, “Network Programmability and Automation”, and how Ansible uses YAML in its playbooks (modules). By the way, I am also doing a “Ansible” deep-dive boot-camp at home too! So, I was working in my Jupyter notebook today and decided to switch things up and further my learning in YAML. If you are wanting to get to know a data serialization language, then YAML is it. Using Jupyter notebooks, all I had to do to get the YAML package was run the following statement: IN [1] import yaml , and I was off to work. Sweat! No pip, sudo, yum, wget or, clone.

You can find their website here.

So break it out and enter this dict:

data = { 'Name': 'Timmy',
    'age': 12,
     'handles': {
         'github': 'toystory',
         'youtube': 'willywonka'},
      'languages': {'markup': ['HTML', 'XML', 'AIML'],
        'programming': ['C', 'C++', 'Python', 'Javascript']}

Then in jupyter enter this:


Look at the output. Now enter the statement below. (Also try taking out the default parameter and view the output once again.) YAML is a great tool!

print(yaml.dump( data, default_flow_style=False))