yaml.dump() dumps python dictionary

Issue #60 new
nnyby
created an issue

yaml.dump() dumps a python dictionary, not the YAML structure. I'm using pyaml 3.11, python 3.5.1:

> import yaml
> d = {'location': '', 'year': '', 'director': '', 'title': 'None', 'copyright': '', 'film_title': '', 'repository': '', 'notes': '', 'copyright_notes': '', 'physical_description': '', 'collection': ''}
> print(yaml.dump(d))
"{collection: '', copyright: '', copyright_notes: '', director: '', film_title: '',\n  location: '', notes: '', physical_description: '', repository: '',\n  title: None, year: ''}\n"

Anyone know what's going on here?

Comments (3)

  1. Max Fischer

    That's not a python literal: the keys lack quotes. Note that a python dict literal is valid YAML - YAML is a superset of most Python and the JSON literals.

  2. Log in to comment