0

I very often use yaml as storage for configuration. Until I have only read yaml I can in yaml file have comments and my formating (for exanoke extra newlines). The problem appears when I want to change one parameter and save it. Example of the problem:

yaml1="""
A:
  B:
    C:1
# comment

D: 2

E: 3
"""
from yaml import load, dump
dump(load(yaml1)) != yaml1

Do you think the library which works in this way will be usable by a bigger audience and it is worth do start that project:

yaml1="""
A:
  B:
    C:1
# comment

D: 2

E: 3
"""
from dictyaml import DictYaml()
dy = DictYaml(yaml1)
dy["A"]["B"]["C"] = 2
str(dy) == """
A:
  B:
    C:2
# comment

D: 2

E: 3
"""
Bartłomiej Bartnicki
  • 1,067
  • 2
  • 14
  • 30

0 Answers0