python-3.x - python : How to call a variable in an

我想请教以下问题:

What is the team name?

How many points did (team_name) score?

我已经试过了,但返回了一个错误:

team_name = input("What is the team name? ")

points = input("How many points did", team_name, "score? ")

请帮忙!

最佳答案

这是执行此操作的 python3.6 方法:

points = input(f"How many points did {team_name} score?")

关于python-3.x - python : How to call a variable in an input prompt?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42104584/

相关文章:

php - 如何从还包含整数的字符串中仅提取 float (小数)

python-3.x - Python 3 inside Sublime Text with Ana

xcode - 如何点击 tvOS 模拟器中的选项卡?

sql - 主键和标识有什么区别?

php - 使用 Carbon PHP 格式化日期

python - Flask 比较字符串

html - 将所有 UL LI 元素对齐在一行中并仅将 CSS 应用于 UL?

python - 如何在 Python 中将 unicode 字符串加载到 json 中?

javafx - 使用多个值过滤 JFX TableView

ruby - 安装 jekyll-admin 到 github pages 托管的 jekyll 站