We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pathlib
https://code-maven.com/minimal-example-generating-html-with-python-jinja Thanks for your amazing jinja example. One suggestion: The first example could be simlified a bit with pathlib
from jinja2 import Environment, FileSystemLoader from pathlib import Path root = Path.cwd() templates_dir = root /'templates' env = Environment( loader = FileSystemLoader(templates_dir) ) template = env.get_template('index.html') filename = root / "rendered_index.html" with open(filename, 'w') as fh: fh.write(template.render( h1 = "Hello Jinja2", show_one = True, show_two = False, names = ["Foo", "Bar", "Qux"], ))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://code-maven.com/minimal-example-generating-html-with-python-jinja
Thanks for your amazing jinja example.
One suggestion: The first example could be simlified a bit with
pathlib
The text was updated successfully, but these errors were encountered: