How do you embed variable in a variable in Jinja2? -
i pass in value jinja2 template called "key". "key" string "user_id" or "birthdate". "key" dictionary key. access {{key}} in jinja2. however, want access value of "key" in dictionary. "item" array of dictionaries. want {{item.{{key}}}}, isn't proper syntax. how should this?
assuming item list, should access offset in list want (e.g. if want offset of x, use item[x]) dictionary. @ point can use dictionary .get() syntax:
item[x].get(key)
Comments
Post a Comment