pyyaml

    53热度

    5回答

    我 >>> import yaml >>> yaml.dump(u'abc') "!!python/unicode 'abc'\n" 但我想 >>> import yaml >>> yaml.dump(u'abc', magic='something') 'abc\n' 什么神奇的力量PARAM没有标记?

    -1热度

    1回答

    我正在编写一个python应用程序。我想使用PyYaml将我的python对象转储到yaml中。我使用Python 2.6并运行Ubuntu Lucid 10.04。我在Ubuntu中使用PyYAML软件包:http://packages.ubuntu.com/lucid/python/python-yaml 我的对象有3个文本变量和一个对象列表。大概是这样的: ClassToDump:

    0热度

    1回答

    这是PyYAML我的机器上的行为方式: >>> plan = {'Business Plan': ['Collect Underpants', '?', 'Profit']} >>> print(yaml.dump(plan)) Business Plan: [Collect Underpants, '?', Profit] 我想的却是这个输出(均是有效的YAML): Business P

    6热度

    3回答

    有这样一个片段: import yaml class User(object): def __init__(self, name, surname): self.name= name self.surname= surname user = User('spam', 'eggs') serialized_user = yaml.dump(user) #N

    1热度

    1回答

    有什么办法可以让PyYaml的默认加载器是CLoader。因此,而不是不得不做 yaml.load(f, Loader=yaml.CLoader) 这将只是默认为CLoader,所以我可以做的: yaml.load(f)

    20热度

    2回答

    如何格式化这样的YAML文档,以便PyYAML能够正确解析它? Data: Some data, here and a special character like ':' Another line of data on a separate line 我知道“:”字符是特殊的,所以我必须围绕整个事情的报价像这样: Data: "Some data, here and a spec

    2热度

    1回答

    我正在使用yaml文件来存储属性和值。但有些值需要添加当前日期。 那么,如何在YAML文件中输入值,使YAML解析器能够自动识别,并与当前的日期代替 我使用pyyaml和python