程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python code error, dont panic! I have sorted out the types of errors

編輯:Python



Python exception handling


  •  ​ Preface ​​
  •  ​ Novice reminder ​​
  •  ​ Exception types ​​
  •  ​ If the software is tested 、 The interface test 、 automated testing 、 Continuous integration 、 The interview experience . If you are interested, you can go to 893694563, There will be test data sharing within the group from time to time . There will also be technology bulls , Share technology with peers in the industry ​​


Preface

python Two very important functions are provided to deal with python Exceptions and errors in the operation of the program . You can use this function to debug python Program

Novice reminder

When a novice writes code , We often encounter code errors , Many of my friends are not good at English , I don't know what it means to report an error ? Now we are sorting out an exception type

Exception types

Exception name

describe

BaseException

The base class for all exceptions

SystemExit

The interpreter requests exit

KeyboardInterrupt

User interrupt execution ( Usually the input ^C)

Exception

Regular error base class

StopIteration

Iterators have no more values

GeneratorExit

generator (generator) An exception occurs to notify the exit

StandardError

All built-in standard exception base classes

ArithmeticError

Base class for all numerical errors

FloatingPointError

Floating point error

OverflowError

The numerical operation exceeds the maximum limit

ZeroDivisionError

except ( Or modulus ) zero ( All data types )

AssertionError

Assertion statement failed

AttributeError

Object does not have this property

EOFError

No built-in input , arrive EOF Mark

EnvironmentError

Base class for operating system errors

IOError

Input / Output operation failed

OSError

Operating system error

WindowsError

System call failed

ImportError

The import module / Object failed

LookupError

Base class for invalid data query

IndexError

There is no index in the sequence (index)

KeyError

There is no key in the map

MemoryError

Memory overflow error ( about Python The interpreter is not fatal )

NameError

Not a statement / Initialize object ( There is no attribute )

UnboundLocalError

Accessing an uninitialized local variable

ReferenceError

Weak reference (Weak reference) Trying to access a garbage collected object

RuntimeError

General runtime errors

NotImplementedError

A method that has not yet been implemented

SyntaxError

Python Grammar mistakes

IndentationError

The indentation error

TabError

Tab Mixed with Spaces

SystemError

General interpreter system error

TypeError

Invalid operation on type

ValueError

Invalid parameter passed in

UnicodeError

Unicode Related errors

UnicodeDecodeError

Unicode Error in decoding

UnicodeEncodeError

Unicode Error in coding

UnicodeTranslateError

Unicode Error in conversion

Warning

The base class for warnings

DeprecationWarning

A warning about abandoned features

FutureWarning

A warning about future semantic changes in construction

OverflowWarning

Old about auto promotion to long form (long) Warning of

PendingDeprecationWarning

A warning that features will be discarded

RuntimeWarning

Suspicious runtime behavior (runtime behavior) Warning of

SyntaxWarning

A dubious grammatical warning

UserWarning

Warnings generated by user code

If the software is tested 、 The interface test 、 automated testing 、 Continuous integration 、 The interview experience . If you are interested, you can go to 893694563, There will be test data sharing within the group from time to time . There will also be technology bulls , Share technology with peers in the industry




  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved