handling curly braces in string formatting - python


language core

let us say you want to print :

{text}

using

'{ {} }'.format(content)

how to escape the {}?

'\{ {} \}'.format(content)

works not the answer ==========

the answer is to double curly braces like that :

'{{ {} }}'.format(content)

simple !