I have this piece of code:
config_object = yaml.safe_load(config_string)
print("passed config: {}".format(config_object))
^^ prints expected yaml structure
print("deserialized config object type: {}".format(type(config_object)))
^^ prints deserialized config object type: <class 'str'>
value = config_object["field1"]["field2"]["field3"]
^^ Error: string indices must be integers
My yaml config:
---
field1:
field2:
field3: value
field4: value
...
I do not understand why string is returned. And I do not see any string return type here: https://pyyaml.org/wiki/PyYAMLDocumentation