Junior — Middle
Have you ever used YAML to describe configurations or manifests?
sobes.tech AI
Answer from AI
Yes, YAML is often used for describing configurations and manifests due to its readability and simplicity. For example, in Python projects, YAML files are used for setting application parameters, describing dependencies, or configuring CI/CD.
Here's an example of a simple YAML config:
server:
host: localhost
port: 8080
database:
user: admin
password: secret
name: mydb
In Python, the PyYAML library is commonly used to work with YAML:
import yaml
with open('config.yaml') as f:
config = yaml.safe_load(f)
print(config['server']['host']) # Outputs 'localhost'