Although there is a custom syntax error from the parser, the same trick works as for calling .format
on regular strings.
Use double curlies:
>>> foo = 'test'
>>> f'{foo} {{bar}}'
'test {bar}'
More Related Contents:
- How to postpone/defer the evaluation of f-strings?
- Fixed digits after decimal with f-strings
- f-strings vs str.format()
- How do I convert a string into an f-string?
- Transform string to f-string
- Nested f-strings
- How can I use newline ‘\n’ in an f-string to format output?
- How can I use f-string with a variable, not with a string literal?
- How to display position of an element in an array? [closed]
- How to blit a random image from a list Pygame [duplicate]
- Lag when win.blit() background pygame
- How do I format a string using a dictionary in python-3.x?
- How can I use `return` to get back multiple values from a for loop? Can I put them in a list?
- Installing scipy in Python 3.5 on 32-bit Windows 7 Machine
- How to run pip from different versions of python using the python command?
- i am sending commands through serial port in python but they are sent multiple times instead of one
- Multiline f-string in Python
- Why is there no xrange function in Python3?
- Get all keys of a nested dictionary [duplicate]
- Type hints when unpacking a tuple?
- CSS not loading wrong MIME type Django [duplicate]
- Sorting by absolute value without changing to absolute value
- FutureWarning: The default value of regex will change from True to False in a future version
- Multiple keys per value
- Python: can’t assign to literal
- json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 190) [duplicate]
- Why isn’t isnumeric working?
- Why are str.count(”) and len(str) giving different outputs when used on an empty string?
- Convert binary string to bytearray in Python 3
- ‘is’ operator behaves unexpectedly with floats