[Python] jinja2 unpack unknown number of values

Discussão em 'Python' iniciado por Stack, Fevereiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    I'm wondering how to unpack a tuple with an unknown number of variables in Jinja2. Specifically, I'm looking for an equivalent syntax or approach in Jinja2 that achieves the same effect as the following Python code:

    a,*_ = d,f,g,e


    In the Python code above, the *_ syntax allows me to discard the remaining variables in the tuple. Is there a similar construct or technique in Jinja2 that allows for this type of unpacking and discarding?

    Thanks

    Continue reading...

Compartilhe esta Página