十年網(wǎng)站開發(fā)經(jīng)驗 + 多家企業(yè)客戶 + 靠譜的建站團隊
量身定制 + 運營維護+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
本文小編為大家詳細介紹“python的docstrings文檔字符串怎么用”,內(nèi)容詳細,步驟清晰,細節(jié)處理妥當,希望這篇“python的docstrings文檔字符串怎么用”文章能幫助大家解決疑惑,下面跟著小編的思路慢慢深入,一起來學習新知識吧。
創(chuàng)新互聯(lián)專注于交口企業(yè)網(wǎng)站建設,響應式網(wǎng)站,商城網(wǎng)站制作。交口網(wǎng)站建設公司,為交口等地區(qū)提供建站服務。全流程按需策劃,專業(yè)設計,全程項目跟蹤,創(chuàng)新互聯(lián)專業(yè)和態(tài)度為您提供的服務
文檔字符串的使用
輸入:
#!/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__)
輸出:
5 is maximum
Prints the maximum of two numbers. The two values must be integers.
解釋:
函數(shù)功能的功能仍然時經(jīng)過
讀到這里,這篇“python的docstrings文檔字符串怎么用”文章已經(jīng)介紹完畢,想要掌握這篇文章的知識點還需要大家自己動手實踐使用過才能領(lǐng)會,如果想了解更多相關(guān)內(nèi)容的文章,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。