【问题标题】:Python Guess the Number [duplicate]Python猜数字[重复]
【发布时间】:2021-04-03 13:42:22
【问题描述】:

(Python猜数字)

这个 f 是从哪里来的?或者这个 f 是什么意思?

代码如下: guess = int(input(f 'Guess a number between 1 and {x}: '))

【问题讨论】:

    标签: python integer


    【解决方案1】:

    这是一种称为 f-string 的表示,他们在 Python 3.6 中开始支持它们

    https://realpython.com/python-f-strings/

    【讨论】:

      【解决方案2】:

      以'f'开头的字符串称为f-string。它是 python 3.6 的新特性之一。您可以在以下链接中了解更多信息:

      Tutorial on Python 3's f-strings

      Official Documentation from python.org

      【讨论】:

        猜你喜欢
        • 2015-08-11
        • 2017-02-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-22
        • 1970-01-01
        • 2023-04-04
        • 2016-06-21
        相关资源
        最近更新 更多