I have a dictionary (created from a Pandas dataframe):
{'name': 'steve', 'info': [{'pipeline': 'product1, product2'}]}
and this is the jinja2 sintax in a.docx template:
{% for x in info %}
• {{x[‘pipeline’]}}
{%endfor%}
the output is:
• product1, product2
but I'd like to have:
• product1
• product2
I'm not able to iterate and separate the values of the "info" key.
Seeing as the value of pipeline is a string you need to add info.split(',') to get [product1, product] as a list that you can iterate over
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.