# Day 15 : Python Libraries for DevOps

Reading JSON and YAML in Python

* As a DevOps Engineer you should be able to parse files, be it txt, json, yaml, etc.
    
* You should know what all libraries one should use in Pythonfor DevOps.
    
* Python has numerous libraries like `os`, `sys`, `json`, `yaml` etc that a DevOps Engineer uses in day to day tasks.
    

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

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1683489954075/16a7919e-b390-46bf-ad60-55bd94d44960.png align="center")

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

services.json :

```bash
{
  "services": {
    "debug": "on",
    "aws": {
      "name": "EC2",
      "type": "pay per hour",
      "instances": 500,
      "count": 500
    },
    "azure": {
      "name": "VM",
      "type": "pay per hour",
      "instances": 500,
      "count": 500
    },
    "gcp": {
      "name": "Compute Engine",
      "type": "pay per hour",
      "instances": 500,
      "count": 500
    }
  }
}
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1683490054917/faf275fe-1240-4b3c-81b9-4d163b7aa481.png align="center")

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

services.yaml :

```yaml
---
services:
  debug: 'on'
  aws:
    name: EC2
    type: pay per hour
    instances: 500
    count: 500
  azure:
    name: VM
    type: pay per hour
    instances: 500
    count: 500
  gcp:
    name: Compute Engine
    type: pay per hour
    instances: 500
    count: 500
```

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1683490158895/9f10835a-eb18-4444-bc27-f5ef66462588.png align="center")

This was it for day 15. If you have any suggestion/questions please comment below.

Looking forward to next challenge.

Happy coding.
