Python NameError: name 'Print' is not defined
I am running a print command on the interpreter that prints this error:
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> Print ("Hello World")
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
Print ("Hello World")
NameError: name 'Print' is not defined
>>> Print ('Hello World')
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
Print ('Hello World')
NameError: name 'Print' is not defined
>>> Print("Hello World")
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <mod开发者_JAVA百科ule>
Print("Hello World")
NameError: name 'Print' is not defined
How can Print
not be defined?
Function and keyword names are case-sensitive in Python. Looks like you typed Print
where you meant print
.
Python is case sensitive.
print('Hello World')
It's not Print
it's print
. Lowercase p.
It seems that your "Print" has got the wrong casing. print should be in lowercase
Python distinguishes uppercase and lowercase two different characters during execution. The reason for this is python doesn't want us to restrict the usages of identifiers and symbols to be used.
how to print hello world in python?
print('Hello World')
Print
is nothing in python.
You mean print
.
I think you need to remove the space between print
and ("Hello World")
You mean print("Hello World")
Final code: print("Hello World")
Use "print" instead of "Print".
Change Print to print(lower case p)
For printing Words on python should try this
print ("Your Words")
It should be print(" ")
with lower case p
in print
function
Python is a case sensitive language, so print
and Print
is 2 different function
As everybody highlighted Python is case sensitive and it should be print
not Print
, but I'm not going to repeat it. If you are new to python you can use Linting
to highlight syntactical and stylistic problems in your Python source code.
Refer to this VS Code plugin for more details about linting: https://code.visualstudio.com/docs/python/linting
精彩评论