Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of typical error report in Python script

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article shares with you the content of a sample analysis of typical error reports in Python scripts. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1 、 IndentationError: expected an indented block

This is caused by the lack of indentation or improper indentation where it should be indented.

Reference:

The Python language is very sensitive to indentation, which brings confusion to many beginners, and even experienced Python programmers may fall into a trap. The most common situation is that the mixing of tab and spaces can lead to errors or incorrect indentation, which is indistinguishable to the naked eye.

An error like this occurs during compilation. IndentationError:expected an indented block means that you need to indent here. All you have to do is press the space or Tab (but do not mix) indentation on the line where the error occurs.

Often some people will wonder: I did not indent at all how wrong, no, should indent the place to indent, do not indent but will make mistakes, such as:

If xxxxxx:

(space) xxxxx

Or

Def xxxxxx:

(space) xxxxx

And

For xxxxxx:

(space) xxxxx

The next line with a colon in a sentence is often indented, and when indented, indent

Source: http://blog.csdn.net/neilhappy/article/details/7724959

2 、 command not found

This kind of error report is that the Python declaration line is missing or invalid, such as #! There are hidden characters in front of it. It is common in Python scripts copied or imported from the Windows platform.

Thank you for reading! This is the end of this article on "sample analysis of typical error reports in Python scripts". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report