from simpleyaml import SimpleYAML
yaml_path = 'config.yaml'
syaml = SimpleYAML()
config = syaml.load(yaml_path)
print(config['database']['host'])
print(config['database']['port'])
config['database']['port'] = 3307
syaml.dump(config, yaml_path)
database:
host: localhost
port: 3306
username: root
password: pass123