Go to file
xuyong 77bf0a8aaa Add readme file and some other configuration files.
Signed-off-by: xuyong <xuyong59@huawei.com>
2022-01-05 14:34:01 +08:00
.github/workflows Update Python 3.10 versions for Windows build 2021-10-13 12:12:44 -07:00
examples Use full_load in yaml-highlight example (#359) 2019-12-20 20:38:46 +01:00
lib 6.0 release 2021-10-13 12:12:51 -07:00
packaging/build Omnibus CI/artifact build update 2021-09-29 13:53:30 -07:00
tests The yaml.load{,_all} functions require Loader= now 2021-09-23 14:43:55 -07:00
yaml Remove Python 2 support and simplify 2021-09-23 14:42:00 -07:00
.gitignore Move code from lib3 to lib 2021-09-22 15:52:05 +02:00
announcement.msg 6.0 release 2021-10-13 12:12:51 -07:00
CHANGES 6.0 release 2021-10-13 12:12:51 -07:00
LICENSE 5.4 release 2021-01-19 14:07:59 -05:00
Makefile Makefile tweaks 2021-09-23 14:42:00 -07:00
MANIFEST.in Move code from lib3 to lib 2021-09-22 15:52:05 +02:00
OAT.xml Add readme file and some other configuration files. 2022-01-05 14:34:01 +08:00
pyproject.toml Add a newline character to end of pyproject.toml 2021-01-13 16:58:40 -05:00
README-EN.md Add readme file and some other configuration files. 2022-01-05 14:34:01 +08:00
README.md Add readme file and some other configuration files. 2022-01-05 14:34:01 +08:00
README.OpenSource Add readme file and some other configuration files. 2022-01-05 14:34:01 +08:00
setup.py 6.0 release 2021-10-13 12:12:51 -07:00
tox.ini Add Python 3.10 to tox.ini 2021-10-13 11:57:52 -07:00

PyYAML

PyYAML是一套基于Python实现的全能YAML处理框架。

安装

您可以通过执行python setup.py install完成LibYAML的安装。

默认情况下,setup.py会检查LibYAML是否已安装在LibYAML已安装的情况下会自动构建及安装LibYAML bindings。

如果想忽略相应的检查直接安装LibYAML bindings可以执行以下命令

--with-libyaml: python setup.py --with-libyaml install

如果想关闭检查且忽略构建及安装LibYAML bindings可以执行以下命令

--without-libyaml: python setup.py --without-libyaml install

当LibYAML bindings成功安装之后你可以按照以下方式进行YAML流的加载解析

>>> yaml.load(stream, Loader=yaml.CLoader)
>>> yaml.dump(data, Dumper=yaml.CDumper)

如果您不是很信任某个YAML输入流可以通过安全模式进行加载

>>> yaml.safe_load(stream)

测试

PyYAML包含完整的测试套件您可以通过执行 python setup.py test可以完成相应的测试用例的执行。

更多信息

协议

PyYAML模块由Kirill Simonov xi@resolvent.net编码实现目前由YAML和Python社区负责维护。

PyYAML基于MIT协议发布更多协议相关的内容可以访问LISENCE文件。