I have a string in which i am using string formatting:
'SELECT {} FROM {} WHERE country={} AND \{\}'.format("apples", "tables","home")
Currently this doesnt work though; How to escape the { and } so that the string prints:
SELECT apples FROM tables WHERE country=home AND {}
?
You can escape the {}
sequence by using {{}}
:
>>> 'SELECT {} FROM {} WHERE country={} AND {{}}'.format("apples", "tables","home")
'SELECT apples FROM tables WHERE country=home AND {}'
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