Access python dicts using path strings (mainly just doing this to l2submodule)
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

18 行
446B

  1. #!/usr/bin/env python3
  2. import confthing, yaml
  3. conf = confthing.Config(yaml.safe_load(open("config-test.yaml")), defaults = {
  4. "alpha/aleph/llll": 1337
  5. }, requirements = [
  6. "alpha/bet"
  7. ], clobber_subscript = True)
  8. test = lambda n: print("\"%s\"\n\t%s\n" % (n, conf[n]))
  9. test("")
  10. test("alpha/aleph")
  11. conf["alpha/aleph"] = {"i": "now set to a string"}
  12. test("alpha/aleph/i")
  13. conf["alpha/aleph/i/one/two/three"] = 12345
  14. test("alpha/aleph/i")