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  ""

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值