[Python] Recursive nested string formatting

Discussão em 'Python' iniciado por Stack, Outubro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I want to take something like the following:

    print('{test_{test2}}'.format(test2='test2', test_test2='test3'))


    and produce:

    test3


    But I get the error:

    ValueError: unexpected '{' in field name


    How can I do this?

    Continue reading...

Compartilhe esta Página