Python Forum
what's really wrong with this f-string? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/Forum-General)
+--- Forum: News and Discussions (https://python-forum.io/Forum-News-and-Discussions)
+--- Thread: what's really wrong with this f-string? (/Thread-what-s-really-wrong-with-this-f-string)



what's really wrong with this f-string? - Skaperen - Oct-31-2019

what's really wrong with this f-string? the quotes look right so it must be the backslash.
Output:
>>> a=432 >>> s=f'{a} "\{"' File "<stdin>", line 1 SyntaxError: f-string: unterminated string >>>



RE: what's really wrong with this f-string? - Gribouillis - Oct-31-2019

In the format() syntax, one escapes curly braces by doubling them. It should probably be s=f'{a} "{{"'