Skip to content

Instantly share code, notes, and snippets.

@souenzzo
Created August 19, 2016 13:12
Show Gist options
  • Save souenzzo/4fb0efd0358dc3b15d3354be18805647 to your computer and use it in GitHub Desktop.
Save souenzzo/4fb0efd0358dc3b15d3354be18805647 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python2
from jinja2 import Template
from yaml import load
JYAML="""
- name: Minimal
# comment
tasks:
- name: "Testando 1 2 3 {{ nome }}"
ping:
"""
PPY="""
[ { "name": "Minimal"
# comment
, "tasks":
[ { "name": "Testando 1 2 3 %s"%nome
, "ping": None
}
]
}
]
"""
env = {"nome":"Teste"}
obj1 = load(Template(JYAML).render(env))
print(obj1)
obj2 = eval(PPY, env)
print(obj2)
print (obj1 == obj2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment