How to escape curly-brackets in f-strings?
--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs
--
Chapters
00:00 How To Escape Curly-Brackets In F-Strings?
00:54 Accepted Answer Score 510
01:11 Thank you
--
Full question
https://stackoverflow.com/questions/4252...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #curlybraces #fstring
#avk47
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs
--
Chapters
00:00 How To Escape Curly-Brackets In F-Strings?
00:54 Accepted Answer Score 510
01:11 Thank you
--
Full question
https://stackoverflow.com/questions/4252...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #curlybraces #fstring
#avk47
ACCEPTED ANSWER
Score 510
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}'