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