Created
December 31, 2019 05:05
-
-
Save estshorter/4feb5f3806cc83eba7fb06bd7ceea733 to your computer and use it in GitHub Desktop.
script for testing toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import toml | |
import logging | |
# なんとなくloggingで出力する | |
logging.basicConfig(level=logging.DEBUG, format="{message}", style="{") | |
# 文字列としてパスを与えると読み込める | |
# pathlib.Pathクラスでも可 | |
params = toml.load("./parameter/nominal.toml") | |
# dictクラスとしてロードされる | |
pglo = params["global"] | |
logging.info(pglo["max_timestep"]) | |
logging.info(pglo["param"]) | |
# dumps()で文字列に戻せる | |
logging.info("----Parameters----") | |
# ログにパラメータを書いておくと、シミュレータへの入出力が確認しやすい | |
logging.info(toml.dumps(params)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment