当前位置:网站首页>YAML语法介绍和各种数据类型
YAML语法介绍和各种数据类型
2022-07-22 22:54:00 【Bulut0907】
1. 介绍
1. YAML语法介绍
YAML是一个类似于XML、JSON的标记性语言。它强调以“数据”为中心,并不以标记语言为重点
YAML的语法主要如下:
- 大小写敏感
- 使用缩进表示层级关系
- 缩进统一使用空格,尽量不用tab
- 缩进的空格数不重要,只要相同层级的元素左对齐即可
:后面要加一个空格- #表示注释
- 多段yaml配置放在一个文件中,中间要使用
---分隔
可以使用yaml to json网站进行测试和验证
2. YAML数据类型
2.1 常量:单个的、不能再分割的值
- 布尔类型
key: true
key: True
- 整型
key: 123
- 浮点类型
key: 3.14
- null类型
key: ~
- 日期类型
key: 2022-05-13
- 时间类型
key: 2022-05-13T15:02:31+08.00
- 字符串类型
key: haha # 如果字符串中间有特殊符号,使用双引号或单引号包裹
# 一行写成多行,用引号包裹,在末尾加\
key: "part1\
part2"
2.2 对象:键值对的集合
# 形式一(推荐)
person:
name: zhang_san
age: 18
# 形式二
person: {name: zhang_san, age: 18}
2.3 数组:一组按次序排列的值
# 形式一(推荐)
address:
- 北京
- 上海
# 形式二
address: [北京, 上海]
边栏推荐
- odbc excel--2022-07-21
- Redis transaction and locking mechanism
- Typescript对象扩展之对象原型__proto__与prototype
- 动作捕捉在自动化控制领域的应用
- 【读书笔记->统计学】12-01 置信区间的构建-置信区间概念简介
- synchronized是如何实现的
- RPC-BDY(5)-服务自动注销、负载均衡
- Come on, slide to the next little sister
- How to use C language to realize simple employee information management system
- 使用同一个接口实现不同登录的方式
猜你喜欢
随机推荐
构造函数的初始化、清理及const修饰成员函数
C语言中的字符串
What level of futures company is founder metaphase? Is the account opening safe and reliable?
PIP update a package
Strings in C language
Hcip --- BGP comprehensive experiment
Mria + RLOG 新架构下的 EMQX 5.0 如何实现 1 亿 MQTT 连接
论文阅读:The Perfect Match: 3D Point Cloud Matching with Smoothed Densities
Genesis公链:夯实Web 3.0发展底座
Redis persistence operation (RDB, AOF)
QT 线程退出的几种方式
Text align: center centered
Redis 持久化操作 (RDB, AOF)
阿里云国际版注册成功后添加支付方式
mysql使用sql语句查询某个字段值除10等于0的所有数据
Restclient operation index library - initialize restclient
如何高效安装MindSpore的GPU版本
What's the use of volatile
Arduino中断实现上升沿检测,并执行其他函数
原生js实现dom的获取及操作




![[reading notes > statistics] 12-01 construction of confidence interval - Introduction to the concept of confidence interval](/img/27/0431eeedbffdba1bdf4bb015082219.png)




