Python Learning Documentation Guidelines

Source: Internet
Author: User

Python Documentation Resources:

Form Role
#注释 Documents in the file
Dir function List of available properties in an object
Document string: __doc__ Documents attached to a file on an object
Pydoc:help function Interactive Help for objects
Pydoc:html Report Module documentation in the browser
Standard Manual Official Language and library instructions
Site Resources Online tutorials, examples, etc.
Published books Business Reference Books

1. #注释

#注释只能从源代码文件中看到, to view the # comment information, you only need to get the appropriate module file.

2. Dir function

A simple way to get a list of all the properties available within an object (for example, the method of an object and a simple data item), which can invoke any object that has attributes.

3. Document String: _ _doc_ _(documents that are automatically attached to an object) such comments are written as strings, placed at the top of module files, functions, and class statements, before any executable program code. Python automatically encapsulates the string so that it becomes the __doc__ property of the corresponding object. The document string that invokes the method function of the class in the module, which can be accessed through the path class: module.class.method.__doc__
  module documentationwords Go here   spam  =40def   square (x):       function documentation can we have your liver then?   return  x **2class   employee:  "  class documentation   " pass  print  (Square (4 print  (Square. __doc__ ) 
Import docstrings    function Documentation    can we have your liver then? Print (Docstrings. __doc__ ) Module documentationwords Gohereprint(docstrings.square.  __doc__)    function Documentation    can we have the your liver then? Print (Docstrings.employee. __doc__ )    class documentation
Built-in document string 4. pydoc:help functionMain Pydoc interface: Built-in Help function and Pydoc gui/html interface. You can use Help for modules, built-in functions, methods, and types. 5. Pydoc:html Report 6. Python Manual

Python Learning Documentation Guidelines

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.