Here is the String:
'''This is a test { <-- escape these ---> } '''
I would like to escape the
{
and
}
in format method, how can I do so? Thanks.
Format String Syntax:
If you need to include a brace character in the literal text, it can be escaped by doubling: {{ and }}.
Try this:
'''This is a test {{ <-- escape these ---> }} and the value is {0}'''.format(42)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With