How could I generate the expected output ? Thanks
jinja template
{%- for field in fields -%}
-
name: {{field}}
type: string
{%- endfor -%}
output
-
name: operating revenue
type: string-
name: gross operating profit
type: string-
expected output
-
name: operating revenue
type: string
-
name: gross operating profit
type: string
code
from jinja2 import Template
fields = ["operating revenue", "gross operating profit", "EBITDA", "operating profit after depreciation", "EBIT", "date"]
template_file = open('./fields_template.jinja2').read()
template = Template(template_file)
html_rendered = template.render(fields=fields)
print(html_rendered)