Skip to main content

Command Palette

Search for a command to run...

Day 15 Task: Python Libraries for DevOps

Published
•2 min read•View as Markdown
Day 15 Task: Python Libraries for DevOps

JSON in Python

In Python, JSON (JavaScript Object Notation) is a popular data format used for exchanging data between a server and a web application, or between different systems. It provides a lightweight and human-readable way of representing structured data.

The json module in Python provides functions for working with JSON data. Here's a brief overview of how you can use JSON in Python.

Importing the json module: import json

Converting JSON to Python objects: The json module provides the json.loads() function to parse a JSON string

YAML in Python

YAML, a recursive acronym for “YAML Ain’t Markup Language,” is a human-readable data serialization language. It is often used for configuration files but also for data exchange. The most used Python YAML parser is PyYAML, a library that allows you to load, parse, and write YAML, much like Python’s JSON library helps you to work with JSON.

Tasks:

  1. Create a Dictionary in Python and write it to a JSON File.

    1. Read a JSON file services.json kept in this folder and print the service names of every cloud service provider.

      output

      aws: ec2

      azure: VM

      gcp: compute engine

      1. Read YAML files using Python, file services. yaml and read the contents to convert yaml to json

        Day 15 task is completed!

        Happy learning!!!!

More from this blog

Untitled Publication

34 posts