Skip to content

Instantly share code, notes, and snippets.

@innyso
Last active May 16, 2020 05:31
Show Gist options
  • Save innyso/7e810914e91e72826aa3af7041fceeb7 to your computer and use it in GitHub Desktop.
Save innyso/7e810914e91e72826aa3af7041fceeb7 to your computer and use it in GitHub Desktop.
#python #jinja #template #input #snippet

Code snippet for how to use jinja2 with file as an input for template.

from jinja2 import Environment,FileSystemLoader

env = Environment(loader=FileSystemLoader('files'))
template = env.get_template('somefilename.sh.j2')
output = template.render(name='elmo')
print output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment