如何在print()字符串中嵌入一个变量,然后在python 3.9中调用一个函数



我正在编写python代码,该代码要求用户输入自己的名称,理论上它运行得很好,但当我运行脚本时,我会得到以下3行作为输出:

Please Enter your name
Your name will be saved as,  <built-in function input>

这是代码:

# Function for the user's name and then sends user to menu
print("Please Enter your namen")
name = input
print("Your name will be saved as, ", name,)
menu()

行。name=输入。保存使用函数"input"所需的函数;输入";以正确的方式

# Function for the user's name and then sends user to menu
print("Please Enter your namen")
name = input()
print("Your name will be saved as, ", name,)
menu()

相关内容

最新更新