Skip to content

Instantly share code, notes, and snippets.

@slinkp
Created March 16, 2016 20:56
Show Gist options
  • Save slinkp/1a112530695033da3fbe to your computer and use it in GitHub Desktop.
Save slinkp/1a112530695033da3fbe to your computer and use it in GitHub Desktop.

For example if I paste this:

--- 
thing: 
  description: "Oh boy."
  stuff: 
    - "i am a string"
    - null
    - ~
    - "null"

into http://www.yamllint.com/ and click "go", then the output is like this - the unquoted null got turned into a tilde:

--- 
thing: 
  description: "Oh boy."
  stuff: 
    - "i am a string"
    - ~
    - ~
    - "null"

And if I load it in python, I get this (two Nones and a string "null"):

>>> import yaml
>>> data = yaml.load(open('foo.yaml', 'r'))
>>> data
{'thing': {'stuff': ['i am a string', None, None, 'null'], 'description': 'Oh boy.'}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment