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
  • 23,210
  • 7
  • 49
  • 68
Santhosh
  • 7,522
  • 13
  • 60
  • 145

1 Answers1

-1

You can try:

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

or

test = f"{'{'}"
print(test)
Viettel Solutions
  • 1,037
  • 7
  • 13