Ticket #18 (closed defect: worksforme)

Opened 6 years ago

Last modified 6 years ago

[bug] nested dictionnary load works dump doesn't

Reported by: eugene@… Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:
Cc:

Description (last modified by xi) (diff)

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

Changed 6 years ago by xi

  • status changed from new to closed
  • resolution set to worksforme
  • description modified (diff)

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)

Author


E-mail address and user name can be saved in the Preferences.


Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.