Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the docstrings document string of python

Shulou Source: shulou.com Published: 2022-06-01 03:54:37 09月12日 Update

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.

Tags: Characters strings documents articles content functions proper functions ideas new knowledge more steps knowledge knowledge points articles details industry information information channels follow Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Xiaomi Shulou Information Linux Shulou Tech Info