【发布时间】:2018-07-20 15:32:38
【问题描述】:
f 字符串函数
print(f"{theString}")
比这更容易打印字符串
print("{}".format(theString))
但某些站点中的 Python 3 编译器不支持此功能。是否有一些特定版本的 Python 支持此功能。
编辑:Hackerrank.com 像其他一些网站一样只是提到它是 Python 3 或 2 并且没有特定版本
【问题讨论】:
-
它应该适用于版本 >= 3.6
-
This is the PEP that indtroduced f-strings 注意“Python-Version”是3.6
-
谷歌搜索“python f string”会带你到this作为第一个命中,它说明了它适用的python版本。
-
仅供参考,您可以通过
import sys; print(sys.version)查看版本 -
为什么它被否决了? :o
标签: python python-3.x f-string