开发者

Python, name not defined [duplicate]

开发者 https://www.devze.com 2023-03-09 12:38 出处:网络
This question already has answers here: error in python d not defined. [duplicate] (3 answers) Closed 8 years ago.
This question already has answers here: error in python d not defined. [duplicate] (3 answers) Closed 8 years ago.
def main()

 开发者_如何学运维    name = input ("Please enter your name")

     print ("your name is", name)

In this program,(written in python IDLE) when I run it, and enter my name I get this error message.

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

What does not defined mean? Jim was the input, how can I define the input while it could be any conbination of letters?


input() in 2.x interprets its input as Python code. Use raw_input() instead. And stop applying 3.x documentation to 2.x.

0

精彩评论

暂无评论...
验证码 换一张
取 消