python single configuration file

前端 未结 4 607
旧巷少年郎
旧巷少年郎 2021-01-31 18:50

I am developing a project that requires a single configuration file whose data is used by multiple modules.
My question is: what is the common approach to that? should i rea

4条回答
  •  星月不相逢
    2021-01-31 19:30

    The approach you describe is ok. If you want to add support for user config files, you can use execfile(os.path.expanduser("~/.yourprogram/config.py")).

提交回复
热议问题