我需要对YAML文件的内容进行排序,我正在学习ruamel.yaml这样做。
给定此文件example.yml
---
- job:
name: this is the job name这个Python程序:
import sys
import ruamel.yaml
yaml = ruamel.yaml.YAML() # defaults to round-trip
# Read YAML file
with open('example.yml', 'r') as f:
data = yaml.load(f)
yaml.dump(data[0]['job']['name'], sys.stdout)我知道工作名称,但我也有一个额外的行与...
$ python example.py
this is the job name
...
$我没想到会看到...,所以我有点困惑。它是从哪里来的,为什么?
https://stackoverflow.com/questions/74541169
复制相似问题