我希望能够从配置文件部分读取文件的变量列表,并使用该列表中的键指向为每个文件定义属性的其他部分。这些文件的编号、名称和属性都可以更改。有没有人见过这样做的方法或者能给我指出正确的方向吗?在
[paths]
file1=/some/path/
file2=/some/other/path
[file1]
key_specific_to_file_1=some_attribute_value
[file2]
key_specific_to_file_2=some_attribute_value2
[non-file-related-section]
some_key=some-other-value
有标准模块configparser。可以找到文档configparser documentation
简单示例:
相关问题 更多 >
编程相关推荐