Python learning warn () function

Source: Internet
Author: User

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

Related Article

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.