This question already has answers here:
Properties file in python (similar to Java Properties)
(23个答案)
6年前关闭。
在Java中,我可以使用
Python使用了什么对应概念? (如果它取决于版本,那么我对Python 2.5的解决方案感兴趣)。
(23个答案)
6年前关闭。
在Java中,我可以使用
.properties
文件来指定一些程序参数(例如数据文件位置)。Python使用了什么对应概念? (如果它取决于版本,那么我对Python 2.5的解决方案感兴趣)。
最佳答案
我认为您对ConfigParser软件包感兴趣。它具有成为标准库的一部分的优势,这意味着它可以跨平台使用,并且随处可见。
http://docs.python.org/library/configparser.html