How to use the docstrings document string of python
In this article Xiaobian for you to introduce in detail "python docstrings document string how to use", detailed content, clear steps, details handled properly, I hope that this "python docstrings document string how to use" article can help you solve doubts, the following follow the editor's ideas slowly in-depth, together to learn new knowledge bar.
The use of document strings
Enter:
#! / usr/bin/python
# Filename: func_doc.py
Def printMax (x, y):
Prints the maximum of two numbers. The two values must be integers.'''
X = int (x)
# convert to integers, if possible
Y = int (y)
If x > y:
Print (x,'is maximum')
Else:
Print (y,'is maximum')
PrintMax (3,5)
Print (printMax.__doc__)
Output:
5 is maximum
Prints the maximum of two numbers. The two values must be integers.
Explanation:
The function of the function still passes through the
Read here, this "python docstrings document string how to use" article has been introduced, want to master the knowledge of this article also need to practice and use to understand, if you want to know more about the article, welcome to follow the industry information channel.