Modify

Ticket #18 (closed defect: worksforme)

Opened 8 years ago

Last modified 3 days 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

comment:1 Changed 8 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

comment:2 Changed 3 days ago by simas <kerdos@…>

 Cipto Junaedy is a customer research expert. "There are plenty of safe, effective HCA nutritional supplement out there. Finding one with  Unit Link Terbaik di Indonesia Commonwealth Life Investra Link 60% HCA with no food additives is vital."

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.