ini 文件 - 从另一个 ini 文件引用变量
ini file - Refer variable from another ini file
如何从另一个 ini 文件解析变量?
在下面的示例中,我想从 original_configuration.ini
解析 var_a
并在 new_configuration.ini
处使用它
original_configuration.ini:
[Section A]
var_a = "foo"
var_b = "bar"
new_configuration.ini:
[Section B]
var_c = "lorem"
var_d = {value of var_a in original_configuration.ini}
由于 INI file 是一个 非正式标准 它取决于使用配置文件的程序:
The INI file format is an informal standard for configuration files for some platforms or software. INI files are simple text files with a basic structure composed of sections, properties, and values.
Wikipedia nor Microsoft's page about INI configutariont files mention anything about referring to other properties or other configuration files. However since it is not a formal standard, each configuration parser can have its own variant. This answer for example, shows that Python's configparser
包都不能引用其他属性:
[env]
name = DEV
[dir]
home = /home/${env:name}/scripts
如何从另一个 ini 文件解析变量?
在下面的示例中,我想从 original_configuration.ini
解析 var_a
并在 new_configuration.ini
处使用它
original_configuration.ini:
[Section A]
var_a = "foo"
var_b = "bar"
new_configuration.ini:
[Section B]
var_c = "lorem"
var_d = {value of var_a in original_configuration.ini}
由于 INI file 是一个 非正式标准 它取决于使用配置文件的程序:
The INI file format is an informal standard for configuration files for some platforms or software. INI files are simple text files with a basic structure composed of sections, properties, and values.
Wikipedia nor Microsoft's page about INI configutariont files mention anything about referring to other properties or other configuration files. However since it is not a formal standard, each configuration parser can have its own variant. This answer for example, shows that Python's configparser
包都不能引用其他属性:
[env]
name = DEV
[dir]
home = /home/${env:name}/scripts