python - 为什么某些站点中的 Python 3 IDE 不支持 f 字符串函数?
问题描述
f 字符串函数
print(f"{theString}")
比这更容易打印字符串
print("{}".format(theString))
但是某些站点中的 Python 3 编译器不支持此功能。这个函数是否有一些特定版本的 Python 来支持这个。
编辑:Hackerrank.com 像其他一些网站一样只是提到它作为 Python 3 或 2 并且没有特定版本
解决方案
Python 3.6 引入了 f-strings。任何 python 3.6 或更高版本都将支持此功能。
推荐阅读
- c# - Distinct() 不起作用,在 .NET 5 和 4.7.2 中表现不同
- java - 没有 Spring Boot 的 JPA 是否可以使用 Java/JERSY
- python - 如何使用 Python 在一系列字符串中搜索关键字列表?
- pine-script - Tradingview中超过40条证券信息
- angular - 角度:无法让我的数据显示在我的 HTML 文件中
- encryption - 添加帐户时,如何强制执行密码规则,只有密码的哈希?
- excel - 如何从Excel中的2个字符串中提取一个字符串,从第二个字符串而不是从默认左侧开始计数
- c++ - 快速舍入定点数
- google-cloud-platform - GCP 数据流配额问题
- html - 从汤对象中提取包含所需字符串的行