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.
🌐
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 - In Python, you can use f-strings (formatted string literals) to insert variables into strings with curly braces {}. This is available in Python 3.6 and later.
Discussions

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
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 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
🌐
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
We then added the str.format() method and passed the value of the integer 5 to that method. This places the value of 5 into the string where the curly braces were: Sammy has 5 balloons. We can also assign a variable to be equal to the value of a string that has formatter placeholders:
🌐
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.
🌐
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 {}.
🌐
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.
Find elsewhere
🌐
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
values = [['First Name Last name', 20],['First Name Last name', 25],['First Name Last name', 30]] test = [1]*3 for i in range(3): val = f'''values[{i}]''' #First create innerpart test[i] = f'''({{{val}}})''' #Then encapsulate it in curly brackets and paranthesis insert = ' '.join(test) f'''Test {insert}'''
🌐
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.
🌐
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 - As you can see, the double curly braces are interpreted as a single set of curly braces in the output string, while the single curly braces surrounding my_var are interpreted as a format specifier. In conclusion, using double curly braces is an easy way to include curly braces in Python format strings without them being interpreted as format specifiers.
🌐
sebhastian
sebhastian.com › python-insert-variable-into-string
How to insert a variable into a string in Python | sebhastian
May 5, 2023 - Another option to insert variables into a string is to use the % operator. When using this option, you need to include the % operator followed by a format specifier to let Python know how the variables should be inserted.
🌐
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.
🌐
Python Tutorial
pythontutorial.net › home › python basics › python f-strings
Python F-strings: a Practical Guide to F-strings in Python
March 30, 2025 - Then, place the name variable inside the curly braces {} in the literal string. Note that you need to prefix the string with the letter f to indicate that it is an f-string.
🌐
Python Central
pythoncentral.io › python-string-interpolation-a-comprehensive-guide
Python String Interpolation: A Comprehensive Guide | Python Central
March 1, 2024 - Using f-strings: Put the letter f before any string literal to indicate the need for replacement. When using f-strings, literals can contain the variable to use for substitution and curly braces ({}) that delimit an expression.
🌐
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.
🌐
pythontutorials
pythontutorials.net › blog › how-do-i-escape-curly-brace-characters-in-a-string-while-using-format-or-an-f-string
How to Escape Curly Braces in Python .format() and F-Strings: Examples & Solutions — pythontutorials.net
To include literal braces in an f-string, use double braces: # Correct: Escape with double braces name = "Charlie" f_str = f"Hello {{name}}!" # Note: {name} is NOT evaluated here print(f_str) # Output: "Hello {name}!" Here, {{name}} is treated as a literal, so name is not evaluated (unlike {name}, which would insert the variable name).
🌐
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