-1
data = f'"{name}": ' + "{" + tmp + "},"  

I have such a string, but I need so that I can use the string {} as for a variable or just as a string. What do I need to do for this?

Andrej Kesely
  • 118,151
  • 13
  • 38
  • 75
  • Read the documentation for f-strings https://docs.python.org/3/reference/lexical_analysis.html#f-strings – DisappointedByUnaccountableMod May 20 '21 at 18:03
  • 2
    Does this answer your question? [How can I print literal curly-brace characters in a string and also use .format on it?](https://stackoverflow.com/questions/5466451/how-can-i-print-literal-curly-brace-characters-in-a-string-and-also-use-format) – Jonathan Feenstra May 20 '21 at 18:07

1 Answers1

3

You need double curly brackets

>>> print(f"{{}}")
{}
wjandrea
  • 23,210
  • 7
  • 49
  • 68
paulgavrikov
  • 1,831
  • 2
  • 26
  • 51