小编dte*_*hie的帖子

python中的错误未定义.

我正在学习python并且有这个错误.我可以弄清楚代码中的错误是什么. File "<string>", line 1, in <module>.

Name = ""
Desc = ""
Gender = ""
Race = ""
# Prompt user for user-defined information
Name = input('What is your Name? ')
Desc = input('Describe yourself: ')
Run Code Online (Sandbox Code Playgroud)

当我运行该程序

它输出你的名字是什么?(我输入d)

这给出了错误

Traceback (most recent call last):
  File "/python/chargen.py", line 19, in <module>
    Name = input('What is your Name? ')
  File "<string>", line 1, in <module>
NameError: name 'd' is not defined
Run Code Online (Sandbox Code Playgroud)

这是Python 3 for Absolute Beginners的示例代码.

python python-3.x

13
推荐指数
1
解决办法
4万
查看次数

标签 统计

python ×1

python-3.x ×1