4

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

2
  • br = '{}';print(f'hello world {br}') Commented Jul 5, 2021 at 19:47
  • 8
    print(f'Hello world {{}}') Commented Jul 5, 2021 at 19:48

1 Answer 1

13

This should work

print(f"hello world {{}}")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.