赞
踩
官方的解释:
PEP 498 – Literal String Interpolation | peps.python.org
F-strings provide a way to embed expressions inside string literals, using a minimal syntax. It should be noted that an f-string is really an expression evaluated at run time, not a constant value. In Python source code, an f-string is a literal string, prefixed with ‘f’, which contains expressions inside braces.
概要翻译一下就是:python的print字符串前面加f表示格式化字符串,加f后可以在字符串里面使用用花括号括起来的变量和表达式。
大括号=花括号=brace
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。