Why am I getting “invalid syntax” from an f-string? [duplicate]

As suggested by Josh Lee in the comment section, that kind of string interpolation was added in Python 3.6 only, see What’s New In Python 3.6 (here it’s called “PEP 498: Formatted string literals”).

You, however, seems to be using Python 3.5.2, which does not support that syntax.

Leave a Comment