Back
y = " \{ Hi\} {0} "print y.format(43)
it's showing an error:
Key Error: Hi\\
I want to print the output from the above syntax:
{Hi} 43
It's pretty simple, Just double the {{ and }}
>>> y = " {{ Hi }} {0} ">>> print y.format(43)' { Hi } 43 '
Or you can also try this as described by Python documentation.
Cheers...!!
You escape it by doubling the braces.
x = "{{ Hello }} {0}"print x.format(42)
x = "{{ Hello }} {0}"
print x.format(42)
You can use the following video tutorials to clear all your doubts:-
31k questions
32.8k answers
501 comments
693 users