日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python的help函數(shù)怎么用

python內(nèi)置了很多內(nèi)置函數(shù)、類方法屬性及各種模塊。當(dāng)我們想要當(dāng)我們想要了解某種類型有哪些屬性方法以及每種方法該怎么使用時,我們可以使用dir()函數(shù)和help()函數(shù)在python ide交互式模式下獲得我們想要的信息。

我們提供的服務(wù)有:成都網(wǎng)站制作、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認(rèn)證、沈北新ssl等。為1000多家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的沈北新網(wǎng)站制作公司

dir()

dir()用來查詢一個類或者對象所有屬性,比如:

>>> dir(list)
['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', 
'__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', 
'__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
'__reversed__', '__rmul__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'append',

help()

help()函數(shù)幫助我們了解模塊、類型、對象、方法、屬性的詳細(xì)信息,幫助查看類型詳細(xì)信息,包含類的創(chuàng)建方式、屬性、方法。

>>> help(list)
Help on class list in module builtins:

class list(object)
 |  list() -> new empty list
 |  list(iterable) -> new list initialized from iterable's items
 |
 |  Methods defined here:
 |
 |  __add__(self, value, /)
 |      Return self+value.
 |
 |  __contains__(self, key, /)
 |      Return key in self.
 |
 |  __delitem__(self, key, /)
 |      Delete self[key].
 |
 |  __eq__(self, value, /)
 |      Return self==value.
 |
 |  __ge__(self, value, /)
 |      Return self>=value.
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __getitem__(...)
 |      x.__getitem__(y) <==> x[y]
 |
 |  __gt__(self, value, /)
 |      Return self>value.
 |
 |  __iadd__(self, value, /)
 |      Implement self+=value.
 |
 |  __imul__(self, value, /)
 |      Implement self*=value.
 |
 |  __init__(self, /, *args, **kwargs)
-- More  --

 舉例如下:

查看python所有的關(guān)鍵字:help("keywords")

查看python所有的modules:help("modules")

單看python所有的modules中包含指定字符串的modules: help("modules yourstr")

查看python中常見的topics: help("topics")

查看python標(biāo)準(zhǔn)庫中的module:import os.path + help("os.path")

查看python內(nèi)置的類型:help("list")

查看python類型的成員方法:help("str.find")

查看python內(nèi)置函數(shù):help("open")


當(dāng)前名稱:創(chuàng)新互聯(lián)Python教程:python的help函數(shù)怎么用
網(wǎng)站URL:http://www.dlmjj.cn/article/dhohsjc.html