Skip to main content

Command Palette

Search for a command to run...

Python Libraries for DevOps

Published
โ€ข1 min readโ€ขView as Markdown
Python Libraries for DevOps

Task 1: Create a Dictionary in Python and write it to a json File.

Task 2: Read a json file services.json kept in this folder and print the service names of every cloud service provider.

Use Python's json module to parse the JSON data and then iterate through the data structure to extract the required information.

Use the following Python code to read and print the service names of every cloud service provider:

Task3: Read YAML file using python, file services.yaml and read the contents to convert yaml to json.

First, install the pyyaml as follows:

pip install pyyaml

Once you've installed pyyaml, you can use the following Python code to read services.yaml and convert its contents to JSON:

Assuming your services.yaml file contains data in a YAML format like this:

Here's the Python code to read and convert it to JSON:

Run the samplecode2.py code and the output is as follows:

๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒThank you for reading!!!!!!!!!!!!!!!!

More from this blog

Beulah's blog

19 posts

Cloud and DevOps Enthusiast