首页 > 解决方案 > 为什么某些站点中的 Python 3 IDE 不支持 f 字符串函数?

问题描述

f 字符串函数

print(f"{theString}")

比这更容易打印字符串

print("{}".format(theString))

但是某些站点中的 Python 3 编译器不支持此功能。这个函数是否有一些特定版本的 Python 来支持这个。

编辑:Hackerrank.com 像其他一些网站一样只是提到它作为 Python 3 或 2 并且没有特定版本

图片

标签: pythonpython-3.xf-string

解决方案


Python 3.6 引入了 f-strings。任何 python 3.6 或更高版本都将支持此功能。


推荐阅读