跳到主要内容
uencoder

INI

INI 是传统的配置文件格式,用 [section] 分组与 key=value 键值对,简单但无标准,各实现语法略有差异。

用途

提供最简单的配置格式,适合少量平面键值配置,无需嵌套。

机制

由节([section])与键值对(key=value)组成,注释用 ; 或 #。无嵌套结构、无类型(全为字符串)。Windows .ini 与 Python configparser 为常见实现,语法细节各异。

用例

  • Windows 配置文件
  • Git .gitconfig 配置
  • Python configparser 配置解析
  • 遗留应用配置

示例

  • 输入
    [user]
    name = Ada
    输出
    The section {user:{name:"Ada"}}

    Everything is a string

常见错误

Implementations differ in syntax (comment markers, case handling)
Pin down the target implementation and consult its documentation

相关词条

相关工具

参考链接