0

I am trying the below in python with f string

test=f"""
{
"""

print(test)

It gives the error

  Input In [39]
    """
       ^
SyntaxError: f-string: expecting '}'

I want it to print { as it is

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Santhosh
  • 9,965
  • 20
  • 103
  • 243

1 Answers1

-1

You can try:

test = f"""{{"""
print(test)

or

test = f"{'{'}"
print(test)
Viettel Solutions
  • 1,519
  • 11
  • 22