zoukankan      html  css  js  c++  java
  • 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 ""

     

  • 相关阅读:
    51nod1370 排列与操作
    2019-11-20-Github-给仓库上传-NuGet-库
    2019-11-20-Github-给仓库上传-NuGet-库
    2019-6-5-WPF-隐藏系统窗口菜单
    2019-6-5-WPF-隐藏系统窗口菜单
    2019-8-31-AutoHotKey-用打码的快捷键
    2019-8-31-AutoHotKey-用打码的快捷键
    2019-4-10-win10-uwp-自定义标记扩展
    2019-4-10-win10-uwp-自定义标记扩展
    2018-9-3-C#-const-和-readonly-有什么区别
  • 原文地址:https://www.cnblogs.com/GarfieldTom/p/2799942.html
Copyright © 2011-2022 走看看