YAML语言学习笔记

zxl19 2026-08-15

我的YAML语言学习笔记。

YAML Hello World

  1. YAML是一种人类可读的数据序列化语言,是YAML Ain’t Markup Language的递归缩写;
  2. YAML语法:

    • 整型:

        canonical: 12345
        decimal: +12,345
        octal: 014
        hexadecimal: 0xC
      
    • 浮点型:

        canonical: 1.23015e+3
        exponential: 12.3015e+02
        fixed: 1,230.15
      
    • 字符串:

        string: foo
        doublequoted: "Double-quotes allow escape sequences.\u263A"
        singlequoted: 'Single quotes do not'
      
    • 杂项:

        true: true
        false: false
        true-y: y
        false-n: n
        string: '12345'
      
    • 列表和字典:

        dict: {a: 1, b: 2}
        list: [1, 2, 3, 4, 5]
      

参考

  1. The Official YAML Website
  2. YAML Overview-ROS Wiki
  3. yaml/www.yaml.org
  4. toml-lang/toml
  5. TOML: Tom’s Obvious Minimal Language
  6. TOML教程-可能是目前最好的配置文件格式-龙腾道默默地的文章-知乎
  7. TOML使用全解析:配置文件的最佳实践-fish的文章-知乎