Created
August 19, 2016 13:12
-
-
Save souenzzo/4fb0efd0358dc3b15d3354be18805647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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