Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to display {} as part of python f string [duplicate]

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

like image 519
Dickson Afful Avatar asked Sep 12 '25 01:09

Dickson Afful


1 Answers

This should work

print(f"hello world {{}}")
like image 141
dchoruzy Avatar answered Sep 13 '25 16:09

dchoruzy