免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

查看python模塊的方法-創新互聯

創新互聯www.cdcxhl.cn八線動態BGP香港云服務器提供商,新人活動買多久送多久,劃算不套路!

創新互聯,為您提供成都網站建設成都網站制作、網站營銷推廣、網站開發設計,對服務水處理設備等多個行業擁有豐富的網站建設及推廣經驗。創新互聯網站建設公司成立于2013年,提供專業網站制作報價服務,我們深知市場的競爭激烈,認真對待每位客戶,為客戶提供賞心悅目的作品。 與客戶共同發展進步,是我們永遠的責任!

小編給大家分享一下查看python模塊的方法,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

python的一個優勢是有著大量自帶和在線的模塊(module)資源,可以提供豐富的功能,在使用這些模塊的時候,如果每次都去網站找在線文檔會過于耗費時間,結果也不一定準確。因此這里介紹下python自帶的查看幫助功能,可以在編程時不中斷地迅速找到所需模塊和函數的使用方法。

通用幫助函數help()

在python命令行中鍵入help(),可以看到:

>>> help()

Welcome to Python 3.5's help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/3.5/tutorial/.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules.  To quit this help utility and
return to the interpreter, just type "quit".

To get a list of available modules, keywords, symbols, or topics, type
"modules", "keywords", "symbols", or "topics".  Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as "spam", type "modules spam".

help>

進入help幫助文檔界面,根據屏幕提示可以繼續鍵入相應關鍵詞進行查詢,繼續鍵入modules可以列出當前所有安裝的模塊:

help> modules
Please wait a moment while I gather a list of all available modules...
AutoComplete        _pyio               filecmp             pyscreeze
AutoCompleteWindow  _random             fileinput           pytweening
......        
Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose name or summary contain the string "spam".

模塊幫助查詢

查看.py結尾的普通模塊help(module_name)

例如要查詢math模塊的使用方法,可以如下操作:

>>> import math
>>> help(math)
Help on built-in module math:
NAME
    math
DESCRIPTION
    This module is always available.  It provides access to the
    mathematical functions defined by the C standard.
FUNCTIONS
    acos(...)
        acos(x)
        Return the arc cosine (measured in radians) of x.
...
>>>

查看內建模塊sys.bultin_modulenames

>>> import sys>>> sys.builtin_module_names
('_ast', '_bisect', '_codecs', '_codecs_cn', '_codecs_hk', ... 'zlib')
>>>

查詢函數信息

查看模塊下所有函數dir(module_name)

如我們需要列舉出math模塊下所有的函數名稱

>>> dir(math)
['__doc__', '__loader__', '__name__',...]
>>>

以上是查看python模塊的方法的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注創新互聯-成都網站建設公司行業資訊頻道!

名稱欄目:查看python模塊的方法-創新互聯
當前鏈接:http://newbst.com/article22/dggejc.html

成都網站建設公司_創新互聯,為您提供標簽優化網站收錄域名注冊企業建站網站制作微信小程序

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都app開發公司