Python configuration file: Any file format recommendation? INI format still appropriate? Seems quite old school

前端 未结 8 1738
执念已碎
执念已碎 2020-12-04 10:43

I need to store configurations (key/value) for a Python application and I am searching for the best way to store these configurations in a file.

I run into Python\'s

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 11:10

    This entirely depends on your requirements. If (as you say) all you need is key/value pairs, ini files (or other "plain" config files) will perfectly suit you. No, they are not outdated, as they are still in use.

    XML/JSON is perfect if you have hierarchical structures and also want to use more sophisticated methods (e.g: XML file validation, namespaces, etc.).

提交回复
热议问题