Python compilation Error Collection

Source: Internet
Author: User

1 indentationerror:expected an indented block

The Python language is a language that is very sensitive to indentation, confusing to many beginners, and even a very experienced Python programmer can be caught in a trap. The most common scenario is that the mix of tab and space results in an error, or indentation is incorrect, which is not possible with the naked eye.

This error will occur at compile time indentationerror:expected an indented block indicates that indentation is required here, as long as you press space or tab (but not mix) to indent the line in the wrong line.

Sentence: The next line with a colon tends to be indented, and the indentation is indented


2 Typeerror:can ' t multiply sequence by non-int of type ' list '

Data type input Error


3 Syntaxerror:invalid syntax

"Illegal statement". Missing punctuation marks (such as missing semicolons, missing & numbers), punctuation, spelling mistakes, and so on can all cause this error.


4 Runtimeerror:maximum recursion depth exceeded

Python's default recursion depth is limited, about 998 times, and throws an exception when the recursion depth exceeds this value.

The solution is to manually set the recursive call depth in the following way:

import sys sys.setrecursionlimit( 1500 )   # set the maximum depth as 1500


5

This article is from the "Squirrel" blog, please be sure to keep this source http://apinetree.blog.51cto.com/714152/1652316

Python compilation Error Collection

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.