Python -Schleife durch Wörterbuch
dictionary = {52:"E",126:"A",134:"B",188:"C",189:"D"}
for key, value in dictionary.items():
print(key)
print(value)
Fancy Fowl
dictionary = {52:"E",126:"A",134:"B",188:"C",189:"D"}
for key, value in dictionary.items():
print(key)
print(value)
new_list = [something(key, value) for key, value in a_dict.items()]
{%- for drink_attribute, ingredient in drink.items()
if drink_attribute.startswith('strIngredient') and ingredient
%}
<td>{{ ingredient }}</td>
{%- endfor %}
<dl>
{% for key, value in my_dict.items() %}
<dt>{{ key|e }}</dt>
<dd>{{ value|e }}</dd>
{% endfor %}
</dl>
<table>
<tbodby>
{% for drink in drinks %}
<tr>
<td>{{ drink.idDrink }}</td>
<td>{{ drink.strDrink }}</td>
<td>{{ drink.strCategory }}</td>
<td>{{ drink.strGlass }}</td>
<td>{{ drink.strInstructions }}</td>
{%- for drink_attribute, ingredient in drink.items()
if drink_attribute.startswith('strIngredient') and ingredient
%}
<td>{{ ingredient }}</td>
{%- endfor %}
</tr>
{% endfor %}
<tbody>
<table>