# 🔥Day15#90daysDevops Challenge

## [Day 15 Task: Python Libraries for DevOps](https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day15/README.md#day-15-task-python-libraries-for-devops)

## [Tasks](https://github.com/LondheShubham153/90DaysOfDevOps/tree/master/2023/day15#tasks)

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

🔷 create a file <mark>task15.py</mark> with the extension `py` as it is a Python file.

import JSON as we have to write in JSON file, then create the directory {}

Give the json\_file name like "MyData.json"

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695801800315/ea2083a9-9b02-4cac-b9a4-b41027ffe56f.png align="center")

---

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

```plaintext
output

AWS: ec2
azure: VM
gcp: compute engine
```

🔷 First, I created two files one Python file <mark>dict_lo.py </mark> and another JSON file <mark>services.json</mark>

🔷 In this task, we have to write a JSON file directory in services.json convert it into a Python file and print the name of only the cloud service provider

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695916886740/f198f5fe-5b88-45a1-b63b-0ec83a44e99b.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695916950938/b32cf6f5-39f9-4a7b-ad8d-9f0089d0848f.png align="center")

---

💎 **Read the YAML file using Python, file** `services. yaml` **and read the contents to convert yaml to JSON**

🔷 For the YAML file, you have to install the required libraries "pyyml"

```plaintext
 pip install pyyml
```

1. ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695924463691/482d128d-1297-4590-9cb5-bc98ff30c47d.png align="center")
    
    🔷 Then created a file "services.json" where I kept yaml dictionary
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695922806227/790888ad-8dcc-4785-b6c1-54c3ea4c041b.png align="center")

🔷 I want to convert this service .yam. file into a Python file

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1695922781260/3ed2f6d0-282e-4980-9812-4e2a97e50217.png align="center")

---
