0 basic python-14.3 Python documentation resources: Help function

Source: Internet
Author: User

In addition to providing __doc__ to query the document string, Python also provides another way to query the document string: Help

Here's a class we built ourselves, using Help to print, to form related report information

>>> class Test (): ' This is a test class ' Def HelloWorld (): ' Test method ' print (' Hello World ') >>> help (Test) to on class Test in Module __main__:class Test (builtins.object) |  This is a Test class |   |  Methods defined here: |   |  HelloWorld () |      Test Method |   |  ---------------------------------------------------------------------- |  Data descriptors defined here: |   |  __dict__ |      Dictionary for instance variables (if defined) |   |  __weakref__ |      

Note: You must fill in the name when using Help, and you cannot use an empty object substitution, for example:

>>> Help (") >>> help (str) Help on Class str in module Builtins:class str (object) |  STR (object= ")-str |  STR (bytes_or_buffer[, encoding[, errors]), str |  

However, if you call the method below the object, we can implement it by using an empty object

>>> help (". Upper) Help on built-in function upper:upper (...) method of Builtins.str instance S.upper    ()-> ; STR        Return a copy of S converted to uppercase.>>> help ([].append) Help on built-in function append:append (.. .) Method of Builtins.list Instance    

It is also important to note that there is no parentheses behind the method, the parentheses will not be queried, even if the method must take parameters, and do not use parentheses


>>> help (". Replace)" On built-in function Replace:replace (...) method of Builtins.str instance    S.replace (old, new[, Count])-STR        Return a copy of S with all occurrences of the substring old    replaced by new.
   if The optional argument count is    


In summary, this section provides a brief explanation of the use of Help


This chapter is here, thank you.

------------------------------------------------------------------

Click to jump 0 basic python-Catalogue



Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

0 basic python-14.3 Python documentation resources: Help function

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.