Ticket #18 (closed defect: worksforme)

Opened 2 years ago

Last modified 2 years ago

[bug] nested dictionnary load works dump doesn't

Reported by: eugene@boardkulture.com Assigned to: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description (Last modified by xi)

import yaml
data=yaml.load("""
a: 1
b:
    ba: 1
    bb: 2
""")
yaml.dump(data)

[gives]

 'a: 1\nb: {ba: 1, bb: 2}\n'

pyYaml 3.0.3 - Python 2.4.3 - Windows XP

Attachments

Change History

07/06/06 16:31:14 changed by xi

  • status changed from new to closed.
  • resolution set to worksforme.
  • description changed.

It's a correct output despite the fact that the style of the nested mapping is different.

If you want collections to be always serialized in a block style, try

>>> print yaml.dump(data, default_flow_style=False)
b:
  bb: 2
  ba: 1
a: 1

Add/Change #18 ([bug] nested dictionnary load works dump doesn't)




Change Properties
Action