Printing { and } with new format syntax

Viewed 12378

I need to add '{' and/or '}' in a string where I use the format function to format the string. For example: I want my string to be "{3}", but this:

"\{{}\}".format(3)

gives me the error:

ValueError: Single '}' encountered in format string

Does anyone know how use '{' and '}' in string formatting?

Thanks, Jeremy

3 Answers
Related