Python模塊和函數的快速查看


如果想查看某個模塊提供了哪些函數等,我們可以進入python控制台,然后導入模塊,再使用help(模塊名)來查看這個模塊的功能有哪些。

 以string模塊為例:

 

 
>>>  import string
>>> help(string)

Help on module string:

NAME
    string - A collection of string operations (most are no longer used).

FILE
    /usr/lib/python2.7/string.py

MODULE DOCS
    http://docs.python.org/library/string

DESCRIPTION
    Warning: most of the code you see here isn ' t normally used nowadays.
    Beginning with Python 1.6, many of these functions are implemented as
    methods on the standard string object. They used to be implemented by
    a built- in module called strop, but strop  is now obsolete itself.
    
    Public module variables:
    
    whitespace -- a string containing all characters considered whitespace
    lowercase -- a string containing all characters considered lowercase letters
    uppercase -- a string containing all characters considered uppercase letters
    letters -- a string containing all characters considered letters
:

 

如果想查看某一個具體的函數,可以使用help(函數名):

>>>help(format)

Help on built- in function format  in module  __builtin__:

format(...)
    format(value[, format_spec]) -> string
    
    Returns value. __format__(format_spec)
    format_spec defaults to  ""

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM