Skip to content

Instantly share code, notes, and snippets.

@mlafeldt
Created October 13, 2011 15:44
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlafeldt/1284577 to your computer and use it in GitHub Desktop.
Save mlafeldt/1284577 to your computer and use it in GitHub Desktop.
[Python] Parse and pretty-print YAML
#!/usr/bin/env python
import sys
import yaml
import pprint
filename = sys.argv[1]
y = yaml.safe_load(open(filename, 'r'))
pp = pprint.PrettyPrinter(indent=4)
pp.pprint(y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment