diff options
| author | Christian Krinitsin <christian.krinitsin@iqmine.de> | 2025-03-24 14:12:25 +0100 |
|---|---|---|
| committer | Christian Krinitsin <christian.krinitsin@iqmine.de> | 2025-03-24 14:12:25 +0100 |
| commit | de990e0f04d6afdc573d30eb9261b12f0300e0ff (patch) | |
| tree | 37f88bfa070fffad85f20643f0430050c4d6cd35 /create_report.py | |
| parent | fc1e101842c5ebfe6321bc836b81bc1d3e8fb782 (diff) | |
| download | testreport-de990e0f04d6afdc573d30eb9261b12f0300e0ff.tar.gz testreport-de990e0f04d6afdc573d30eb9261b12f0300e0ff.zip | |
init
Diffstat (limited to 'create_report.py')
| -rw-r--r-- | create_report.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/create_report.py b/create_report.py new file mode 100644 index 0000000..6a95a14 --- /dev/null +++ b/create_report.py @@ -0,0 +1,22 @@ +from jinja2 import Environment, FileSystemLoader + +# Load the template from the current directory +env = Environment(loader=FileSystemLoader('.')) +template = env.get_template("template.html") + +# Data to be passed into the template +data = { + "title": "My Report", + "items": ["Apple", "Banana", "Cherry"] +} + +data["items"].append("hello") + +# Render the template with data +html_output = template.render(data) + +# Save the generated HTML to a file +with open("report.html", "w", encoding="utf-8") as f: + f.write(html_output) + +print("Report generated: report.html") |