2

Is there any way I can display {} as part of the f string as it has special meaning in f string. In other words:

If run print(f"hello world {}") , I want a results like hello world {}

My attempted solution is: print(f"hello world \{\}"). But it did not work.

A help will be much appreciated

Timur Shtatland
  • 12,024
  • 2
  • 30
  • 47
Dickson Afful
  • 708
  • 1
  • 6
  • 20

1 Answers1

8

This should work

print(f"hello world {{}}")
dchoruzy
  • 249
  • 2
  • 8