Day 15: Python Libraries for DevOps

Table of contents

Today, let’s dive into a crucial aspect of being a DevOps Engineer -> reading JSON and YAML in Python.
Reading JSON and YAML in Python
As a DevOps Engineer, you should be able to parse files, be it txt, json, yaml, etc
Libraries for DevOps in Python
Python has numerous libraries like os
, sys
, json
, yaml
etc that a DevOps Engineer uses in day to day tasks.
Tasks:
Create a Dictionary in Python and write it to a json File.
Read a json file services.json
kept in this folder and print the service names of every cloud service provider.
Now, we’ll read a JSON file, “services.json,” and extract the service names of each cloud service provider. The content of “services.json” is shown below:
Output:
Read YAML file using python, file services.yaml
and read the contents to convert yaml to json
Here you can see the json file
Subscribe to my newsletter
Read articles from Moiz Asif directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
