Why do we use double curly braces here?
Other examples in the tutorial use single curly braces.
I feel confused even after reading the explanation saying that "Braces need to be escaped within a Python string, and we do this by using double quotes."
How do we know whether it is a Python string or not? Since almost all the commands in this tutorial is run by python like the one below.
As answered in this question on stackoverflow and the regarding entry in the documentation:
Format strings contain “replacement fields” surrounded by curly braces {}
. Anything that is not contained in braces is considered literal text, which is copied unchanged to the output. If you need to include a brace character in the literal text, it can be escaped by doubling: {{
and }}
.
If you only use one set of curly braces, then the python string you create is expecting that you want to replace what is inside with variables from the python script. However, that is not what you want to do in the query string.