[Python] Python3 YAML double curly brace no quotes

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

  1. Stack

    Stack Membro Participativo

    I need help with outputting a dictionary value without quotes that contains double curly braces. This yaml file will be used for ansible which supports jinja.

    import yaml

    data = {
    'user' : '{{ val }}'
    }

    print(yaml.dump(data))


    I need the output of this to be user: {{ val }} without quotes. No matter what I try, the output is user: '{{ val }}'. This output needs to be single line / no block indentation.

    Continue reading...

Compartilhe esta Página