Printing { And } With New Format Syntax
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 th
Solution 1:
Simply duplicate the braces:
>>> "{{{0}}}".format(3)
'{3}'
Solution 2:
print"{{{0}}}".format(3)
'{3}'
Post a Comment for "Printing { And } With New Format Syntax"