首页 Python Python,名称未定义

Python,名称未定义

这个问题在这里已经有一个答案: error in python d not defined. 3个 def main() name = input (Please enter your name) print (your name is, nam

这个问题在这里已经有一个答案:>
error in python d not defined. 3个

def main()

     name = input ("Please enter your name")

     print ("your name is",name)

在这个程序中(写入python IDLE)当我运行它,并输入我的名字我收到这个错误消息.

Traceback (most recent call last):

 File "C:\Users\********\Documents\PYTHON\hello world.py",line 66,in ?

   main()

  File "C:\Users\********\Documents\PYTHON\hello world.py",line 5,in main

    name = input ("Please enter your name")

  File "<string>",line 0,in ?

NameError: name 'Jim' is not defined

没有定义是什么意思?吉姆是输入,我如何定义输入,而可能是任何字母的混合?

解决方法

2.x中的input()将其输入解释为Python代码.请改用raw_input().并停止将3.x文档应用于2.x.

本文来自网络,不代表青岛站长网立场。转载请注明出处: https://www.0532zz.com/html/kaifa/python/20210123/16768.html
上一篇
下一篇

作者: dawei

【声明】:青岛站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

返回顶部