String with 'f' prefix in python-3.6
问题 I\'m trying out Python 3.6. Going through new code, I stumbled upon this new syntax: f\"My formatting string!\" It seems we can do things like this: >>> name = \"George\" >>> print(f\"My cool string is called {name}.\") My cool string is called George. Can anyone shed some light on the inner workings of this? In particular what is the scope of the variables that an f-prefixed string can take? 回答1: See PEP 498 Literal String Interpolation: The expressions that are extracted from the string are