I want to place a value into a string, however I cannot access the string as a f-string
because it has multiple curly braces, but also I cannot use the following %s
to access a value in the string as it has multiple %
operators.
Here's an example string:
string = '{{id,name,tagline,frequency,duration,price,formattedPrice,pricePerUnit,formattedPricePerUnit}oneTimePurchase{index}}priceRange(withSubscriptionPriceRange:true),@include(if:$withPriceRange){fromPriceFormatted}discount{mode,value}currency,weight,seoJson}}}&v=%7B%22slug%22%3A%22p8-by-olly-fathers%22%2C%22externalId%22%3A%22%22%2C%22withPriceRange%22%3Afalse%7D'
I wanted to include the following string:
firstRange
inside the following part of the string:
externalId%22%3A%22%2firstRange%2C%22withPriceRange%22%3Afalse%7D
I have tried using:
string % "firstRange"
Aftering inserting %s
in the required position but I get the following error:
ValueError: unsupported format character 'B' (0x42)