I have a string. If I need curly braces, it further exploits the f-strings feature. Is there a language punctuation/syntax which can help me here in this case?
Here are two different ways it doesn't work. I might want to incorporate the literal text "{bar}" as a component of the string.
foo = "test"
fstring = f"{foo} {bar}"
NameError: name 'bar' is not defined
fstring = f"{foo} \{bar\}"
SyntaxError: f-string expression part cannot include a backslash
Desired output:
'test {bar}'