Transcrypt icon indicating copy to clipboard operation
Transcrypt copied to clipboard

Can't compile curly braces in format string

Open sawczakl opened this issue 2 years ago • 0 comments

This expression can't compile and results in an aborted file:

s = 'foo'
f'{{{s}}}'

In Python this results in literal curly braces around the formatted variable:

>>> s = 'foo'
>>> f'{{{s}}}'
'{foo}'

Of course, a workaround is pretty trivial, but I thought it was interesting.

sawczakl avatar Apr 23 '23 03:04 sawczakl