From 6236aa240a5edf24cfef688ff0c2eb7322122f57 Mon Sep 17 00:00:00 2001 From: jacques Grelet <Jacques.Grelet@ird.fr> Date: Wed, 13 Mar 2019 15:23:21 +0000 Subject: [PATCH] test read toml file --- config.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..721db0e --- /dev/null +++ b/config.py @@ -0,0 +1,19 @@ +import toml + +# some examples: +# https://www.programcreek.com/python/example/93872/toml.load +cfg = toml.load('cruise.toml') + +print(cfg['global']['author']) + +for key in cfg['cruise'].keys(): + print(cfg['cruise'][key]) + print(cfg['cruise'].get(key)) + +ctd = cfg['ctd'] +s = ctd['split'] +for key in s.keys(): + print("{}: {}".format(key, s[key])) +s = ctd['splitAll'] +for key in s.keys(): + print("{}: {}".format(key, s[key])) -- GitLab