0

I have the following string I need to format:

header = """
   class SP{
       function A{
           return {}
       }
"""
print(header.format('some_value;'))

What I try to print is:

class SP{
    function A{
         return some_value;
    }

How do I escape the outer {} NOTICE THE IMBALANCED curly brackets

Itay Moav -Malimovka
  • 52,579
  • 61
  • 190
  • 278

1 Answers1

0
header = """
   class SP{{
       return {0}
   }};
"""
print(header.format('some_value;'))