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

前端 未结 8 1748
执念已碎
执念已碎 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 10:58

    It depends on how the config file will be used.

    One of the advantages of INI files is that they are really easy to read and understand. It's much easier to make a mistake in JSON or XML file if you edit config by hand. PHP still uses INI files.

    However, if you your config is not meant to be edited by hand, go with any format you like, because INI is not the easiest one to parse.

提交回复
热议问题