Tag: Microsoft Color message function calls Cat sys logs COL
The Warn () function is located in the warnings module to issue a warning, or to ignore it or throw an exception .
def warn (message, Category=none, stacklevel=1, Source=none)
The first parameter, message, is a string type, which is an instance object of warning.
The second argument is a class object, and he points to the base class of message.
The third parameter is the stack depth, the integer object, and the Sys._getframe () parameter.
The last one will not be said, the basic need not.
Expand:
Sys._getframe ([num])
Returns a Frame object from the call stack. If an optional integer depth is given, many of the called frame objects are returned below the top of the stack.
If this is deeper than the call stack, ValueError is raised. The default value of depth is zero, which returns the frame at the top of the call stack.
Python learning warn () function