Try using triple curly braces. {{ gets converted to a string { (It is an escape sequence).

AccessToken = "AccessTokenValue"
payload={}
headers = { 'authorization': f'{{{AccessToken}}}'}
print(headers)

This will print: {'authorization': '{AccessTokenValue}'}

Answer from Aishwarya Patange on Stack Overflow
🌐
Data Science for Everyone
matthew-brett.github.io › teaching › string_formatting.html
Inserting values into strings — Tutorials on imaging, computing and mathematics
This method works for all current releases of Python. Here we insert a string into another string: >>> shepherd = "Mary" >>> string_in_string = "Shepherd {} is on duty.".format(shepherd) >>> print(string_in_string) Shepherd Mary is on duty. The curly braces show where the inserted value should go.
Discussions

Curly bracket in this code (beginner)
Inside an “f-string” those are references to variables. So it’ll swap in first and last into the full_name string on execution. More on reddit.com
🌐 r/learnpython
9
13
October 21, 2023
python - Can you insert anything other than a variable in {curly braces} of an f string literal? - Stack Overflow
I was writing a print statement to test code. But I realised I mistakenly had put a (self-defined) object (from a different class) in the {}. I have already add the str method in the object to be a... More on stackoverflow.com
🌐 stackoverflow.com
Python F string, insert string with curly brackets inside curly bracket - Stack Overflow
I have a list of values I want to insert inside the parenthesis in an f-string. The length of the list will be different from time to time, therefore, I will make a string with the correct length for More on stackoverflow.com
🌐 stackoverflow.com
python - How do I escape curly-brace ({}) characters characters in a string while using .format? - Stack Overflow
If you need to keep two curly braces in the string, you need 5 curly braces on each side of the variable. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Tutorial Jinni
tutorialjinni.com › python-insert-variable-in-string-with-curly-braces.html
Python insert variable in string with curly braces | Tutorial Jinni
November 6, 2024 - If you need to include curly braces {} in the string itself, you can double them {{ and }}, value = 42 message = f"The value is {{ {value} }}." print(message) Output look like this: The value is { 42 }. Alternatively, for versions before Python ...
🌐
iO Flood
ioflood.com › blog › python-format-string
Python Format String: Techniques and Examples
June 18, 2024 - In this example, we’ve used the format() function to insert variables into a string. The curly braces {} are placeholders where the variables get inserted.
🌐
Manifoldapp
cuny.manifoldapp.org › read › how-to-code-in-python-3 › section › 07f9968a-8f75-4d3c-8573-2e9282745e9e
How To Use String Formatters | How To Code in Python 3 | Manifold @CUNY
In sammy_string we added 4 pairs of curly braces as placeholders for variable substitution. We then passed 4 values into the str.format() method, mixing string and integer data types. Each of these values are separated by a comma. When we leave curly braces empty without any parameters, Python will replace the values passed through the str.format() method in order.
🌐
Stack Overflow
stackoverflow.com › questions › 74004754 › can-you-insert-anything-other-than-a-variable-in-curly-braces-of-an-f-string-l
python - Can you insert anything other than a variable in {curly braces} of an f string literal? - Stack Overflow
in f-string's {curly braces} you can use any variables, class objects, executable expressions, function callings, etc. Anything can be used in brackets. You saw None on {print(self.all_cards)} because print function only returns None in python.
Find elsewhere
🌐
Python Tutorial
pythontutorial.net › home › python basics › python f-strings
Python F-strings: a Practical Guide to F-strings in Python
March 30, 2025 - The f-strings provide a way to embed variables and expressions inside a string literal using a clearer syntax than the format() method. ... How it works. First, define a variable with the value 'John'. Then, place the name variable inside the curly braces {} in the literal string.
🌐
Python Guides
pythonguides.com › create-a-string-with-variables-in-python
Ways to Insert a Python Variable into a String
February 2, 2026 - Since Python 3.6, I’ve almost exclusively used f-strings. They are fast, readable, and very easy to type. You just need to add the letter f before your string and put your variables inside curly braces {}.
🌐
Stack Overflow
stackoverflow.com › questions › 74490781 › python-f-string-insert-string-with-curly-brackets-inside-curly-bracket
Python F string, insert string with curly brackets inside curly bracket - Stack Overflow
Does this answer your question? How to escape curly-brackets in f-strings?. In summary, you have to use 2 brackets instead of one. ... test[i] = f"({values[i]})" you can use list indexing (or pretty much any python expression) in an f string.
🌐
Better Programming
betterprogramming.pub › four-ways-to-print-variables-in-strings-28b346998d22
Four Ways to Print Variables in Strings | by Jonathan Hsu | Better Programming
August 15, 2019 - One of the Python string literal modifiers is the f modifier, which stands for format and allows you to embed Python directly in a string within curly braces.
🌐
Flexiple
flexiple.com › python › insert-variable-string-python
How to Insert a Variable into a String in Python - Flexiple
April 2, 2024 - To create an f-string, simply prepend an 'f' or 'F' before the opening quotation mark. Inside the string, you can place variables within curly braces {}. Python will automatically replace these placeholders with the actual values of the variables.
🌐
sebhastian
sebhastian.com › python-insert-variable-into-string
How to insert a variable into a string in Python | sebhastian
May 5, 2023 - As you can see, this option is intuitive because you can insert a variable right into the string just by adding curly brackets {} around the variable. But keep in mind that this option is available only in Python version 3.6 and up.
🌐
Linux Hint
linuxhint.com › python-string-formatting-tutorial
Linux Hint – Linux Hint
September 10, 2023 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
Datasciencebyexample
datasciencebyexample.com › 2023 › 03 › 28 › include-curly-braces-in-python-format-strings
How to Include Curly Braces in Python Format Strings | DataScienceTribe
March 28, 2023 - When working with Python format strings, it is common to use curly braces ({}) to insert variables or expressions into a string.
🌐
Nipraxis
textbook.nipraxis.org › string_formatting.html
Inserting values into strings — Practice and theory of brain imaging
In Brisk Python, we claimed that Python f-strings are the usual best way to insert variable values into strings. ... There are a couple of other ways you can do the same thing, that may be useful in particular circumstances. You can use the string method format method to create new strings with inserted values. Here we insert a string into another string: ... The empty curly braces show where the inserted value should go.
🌐
CodeRivers
coderivers.org › blog › python-insert-variable-into-string
Python: Inserting Variables into Strings - CodeRivers
February 22, 2026 - f-strings are the most recent and concise way to insert variables into strings. They are prefixed with the letter f and allow you to directly embed Python expressions within curly braces inside the string.
🌐
Edlitera
edlitera.com › blog › posts › python-parentheses
Python Parentheses Cheat Sheet | Edlitera
By using f-strings, you can completely avoid using standard parentheses and instead use only curly braces. You just need to add an f before the string to signal to Python that you are going to use that new functionality to format strings.
🌐
Jeremy Morgan
jeremymorgan.com › python › how-to-print-a-string-and-a-variable-in-python
How to Print a String and a Variable in Python
We can use curly braces {} to indicate where we want to insert variables into our string, followed by a colon and the name of the variable. For example: name = "Jeremy" age = 46 print(f"My name is {name} and I am {age} years old.") ... As you ...