与
stream = open(afile, 'r')
self.meta = yaml.load(stream)
在python中可以很容易地读取YAML文件,但是在I reach错误末尾它没有得到---
(与...
相同):
但是YAML规范allow说:
YAML uses three dashes (“---”) to separate directives from document content. This also serves to signal the start of a document if no directives are present. Three dots ( “...”) indicate the end of a document without starting a new one, for use in communication channels.
你怎么看这个
---
title: "El punt de llibre"
abstract: "Estimar a quina pàgina està el punt de llibre"
keywords: ["when", "activitat", "3/3", "grup", "estimació", "aproximació", "funció lineal - proporcionalitat", "ca"]
comments: true
...
在python中?在
如果您的YAML源文件包含多个文档,则可以使用
然而,奇怪的是,
...
会导致PyYaml中断,您可能需要将其报告为bug。在您的YAML流/文件中似乎有多个文档,例如,尝试解析此文件时,会出现相同的错误消息:
要处理这种流,可以使用以下方法:
^{pr2}$这将显示以下内容:
^{3}$相关问题 更多 >
编程相关推荐