Basic Python Basics Tutorial Python tools common errors

Source: Internet
Author: User

Python-shell Feedback Common Errors

Beginners often use Python-shell to learn the basics of Python and grammar, and when using Python-shell , they will encounter errors such as mistakes, grammatical errors, or misspelled functions or variable names. , now a summary of the mistakes that beginners often make.

variables, functions not defined

Let's briefly summarize the common error hints when using Python-shell.

>>>len = 12>>>letraceback (most recent): File ' <pyshell#36> ', line 1, in <module> Lenameerror:name ' Le ' is not defined>>>

The top Python-shell feedback nameerror:name ' Le 'is not defined, which is said ' le ' variable undefined, indeed, because before we were assigned the Len variable equals 12, Le no assignment is not created so the error is not defined.

>>>len = "www.jeapedu.com" >>> Pint (len) Traceback (most recent call last): File "<pyshell#38>", L Ine 1, in <module> Pint (len) nameerror:name ' pint ' are not defined>>>

From the top Idle-shell feedback nameerror:name ' pint 'is not defined, you can see that the pint function is undefined, it should be the function of print less R letter.

Non-statement characters

In the Python statement instructions put some non-statement characters, how to understand? For example, hitting a (multiple) space before the print function or pressing the TAB key will cause an error when running the statement in Python-shell.

>>> s = ' www.jeapedu.com ' >>> print swww.jeapedu.com>>> print s File "<pyshell#45> ; ", line 1 print s ^indentationerror:unexpected indent>>>

The reason for the 4th line error is that there is a tab or several spaces in front of the print function that causes the syntax to be out of compliance in the Shell and report an error.


This article is from the "Python Training Zhipu Education" blog, so be sure to keep this source http://jeapedu.blog.51cto.com/7878264/1617006

Basic Python Basics Tutorial Python tools common errors

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.