查看python的可用模块

1.这种方式的问题是,只列出当前import进上下文的模块.

进入python命令行.输入以下代码:

$ pythonPython 2.7.2 (default, Jan 19 2012, 18:26:31)[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import sys>>> sys.modules{'copy_reg': , 'sre_compile': , '_sre': , 'encodings': , 'site': , '__builtin__': , 'sysconfig': , '__main__': , 'encodings.encodings': None, 'abc': , 'posixpath': , '_weakrefset': , 'errno': , 'encodings.codecs': None, 'sre_constants': , 're': , '_abcoll': , 'types': , '_codecs': , '_warnings': , 'genericpath': , 'stat': , 'zipimport': , 'encodings.__builtin__': None, 'warnings': , 'UserDict': , 'encodings.utf_8': , 'sys': , 'codecs': , 'readline': , 'os.path': , 'signal': , 'traceback': , 'linecache': , 'posix': , 'encodings.aliases': , 'exceptions': , 'sre_parse': , 'os': , '_weakref': }2.还可以在python命令行下获取在线帮助:>>> help()Welcome to Python 2.7!  This is the online help utility.If this is your first time using Python, you should definitely check outthe tutorial on the Internet at http://docs.python.org/tutorial/.Enter the name of any module, keyword, or topic to get help on writingPython programs and using Python modules.  To quit this help utility andreturn to the interpreter, just type "quit".To get a list of available modules, keywords, or topics, type "modules","keywords", or "topics".  Each module also comes with a one-line summaryof what it does; to list the modules whose summaries contain a given wordsuch as "spam", type "modules spam".>>> modulesPlease wait a moment while I gather a list of all available modules.../usr/local/lib/python2.7/site-packages/nltk/app/__init__.py:30: UserWarning: nltk.app package not loaded (please install Tkinter library). warnings.warn("nltk.app package not loaded "/usr/local/lib/python2.7/site-packages/nltk/draw/__init__.py:16: UserWarning: nltk.draw package not loaded (please install Tkinter library). warnings.warn("nltk.draw package not loaded "/usr/local/lib/python2.7/site-packages/twisted/words/im/__init__.py:8: UserWarning: twisted.im will be undergoing a rewrite at some point in the future. warnings.warn("twisted.im will be undergoing a rewrite at some point in the future.")ArgImagePlugin      _LWPCookieJar       dumbdbm             readabilityBaseHTTPServer      _MozillaCookieJar   dummy_thread        readlineBastion             __builtin__         dummy_threading     redisBdfFontFile         __future__          easy_install        reprBeautifulSoup       _abcoll             email               resourceBeautifulSoupTests  _ast                encodings           rexecBmpImagePlugin      _bisect             engine              rfc822BufrStubImagePlugin _codecs             errno               rlcompleterCDROM               _codecs_cn          exceptions          robotparserCGIHTTPServer       _codecs_hk          ext                 runpyCanvas              _codecs_iso2022     fcntl               schedConfigParser        _codecs_jp          filecmp             scrapyContainerIO         _codecs_kr          fileinput           scrapydCookie              _codecs_tw          fnmatch             selectCrypto              _collections        formatter           serverCurImagePlugin      _csv                fpformat            setsDLFCN               _ctypes             fractions           setuptoolsDcxImagePlugin      _ctypes_test        ftplib              sgmllibDialog              _curses             functools           shaDocXMLRPCServer     _curses_panel       future_builtins     shelveEpsImagePlugin      _elementtree        gc                  shlexExifTags            _functools          genericpath         shutilFileDialog          _hashlib            getopt              signalFitsStubImagePlugin _heapq              getpass             siteFixTk               _hotshot            gettext             sixFliImagePlugin      _imaging            glob                smtpdFontFile            _imagingcms         grp                 smtplibFpxImagePlugin      _imagingft          gzip                sndhdrGbrImagePlugin      _imagingmath        hashlib             socketGdImageFile         _io                 heapq               spwdGifImagePlugin      _json               hmac                sqlGimpGradientFile    _locale             hotshot             sqlalchemyGimpPaletteFile     _lsprof             htmlentitydefs      sqlite3GribStubImagePlugin _md5                htmllib             sreHTMLParser          _multibytecodec     httplib             sre_compileHdf5StubImagePlugin _multiprocessing    idlelib             sre_constantsIN                  _mysql              ihooks              sre_parseIcnsImagePlugin     _mysql_exceptions   imaplib             sslIcoImagePlugin      _pyio               imghdr              statImImagePlugin       _random             imp                 statvfsImage               _sha                importlib           stringImageChops          _sha256             imputil             stringoldImageCms            _sha512             inspect             stringprepImageColor          _socket             io                  stropImageDraw           _sre                itertools           structImageDraw2          _ssl                json                subprocessImageEnhance        _strptime           keyword             sunauImageFile           _struct             lib2to3             sunaudioImageFileIO         _symtable           linecache           symbolImageFilter         _testcapi           linuxaudiodev       symtableImageFont           _threading_local    locale              sysImageGL             _warnings           logging             sysconfigImageGrab           _weakref            lxml                syslogImageMath           _weakrefset         macpath             tabnannyImageMode           _yappi              macurl2path         tarfileImageOps            abc                 mailbox             telnetlibImagePalette        aifc                mailcap             tempfileImagePath           antigravity         markupbase          termiosImageQt             anydbm              marshal             testImageSequence       argparse            math                testsImageShow           array               mcrypt              textwrapImageStat           ast                 md5                 thisImageTk             asynchat            mhlib               threadImageTransform      asyncore            mimetools           threadingImageWin            atexit              mimetypes           thriftImtImagePlugin      audiodev            mimify              timeIptcImagePlugin     audioop             mmap                timeitJpegImagePlugin     base64              modulefinder        tkColorChooserMcIdasImagePlugin   bdb                 multifile           tkCommonDialogMicImagePlugin      binascii            multiprocessing     tkFileDialogMimeWriter          binhex              mutex               tkFontMpegImagePlugin     bisect              netrc               tkMessageBoxMspImagePlugin      bsddb               new                 tkSimpleDialogMySQLdb             bz2file             nis                 toaiffOleFileIO           cPickle             nltk                tokenOpenSSL             cProfile            nntplib             tokenizePIL                 cStringIO           ntpath              tornadoPSDraw              calendar            nturl2path          tracePaletteFile         cgi                 numbers             tracebackPalmImagePlugin     cgitb               opcode              transportPcdImagePlugin      chardet             operator            ttkPcfFontFile         chunk               optparse            ttyPcxImagePlugin      cmath               orm                 turtlePdfImagePlugin      cmd                 os                  twistedPixarImagePlugin    code                os2emxpath          typesPngImagePlugin      codecs              ossaudiodev         unicodedataPpmImagePlugin      codeop              parser              unittestPsdImagePlugin      collections         pdb                 urllibQueue               colorsys            pickle              urllib2ScrolledText        command             pickletools         urlparseSgiImagePlugin      commands            pip                 userSimpleDialog        compileall          pipes               utilSimpleHTTPServer    compiler            pkg_resources       uuSimpleXMLRPCServer  connectors          pkgutil             uuidSocketServer        constants           platform            virtualenvSpiderImagePlugin   contextlib          plistlib            virtualenv_supportStringIO            cookielib           popen2              w3libSunImagePlugin      copy                poplib              warningsTYPES               copy_reg            posix               waveTarIO               crypt               posixfile           weakrefTgaImagePlugin      csv                 posixpath           webTiffImagePlugin     ctypes              pprint              webbrowserTiffTags            curses              profile             whichdbTix                 databases           protocol            wsgirefTkconstants         datetime            pstats              xdrlibTkdnd               dateutil            pty                 xmlTkinter             dbhash              pwd                 xmllibUserDict            decimal             py_compile          xmlrpclibUserList            dialects            pyclbr              xxsubtypeUserString          difflib             pydoc               yamlWalImageFile        dircache            pydoc_data          yappiWmfImagePlugin      dis                 pyexpat             zipfileXVThumbImagePlugin  distutils           quopri              zipimportXbmImagePlugin      django              random              zlibXpmImagePlugin      doctest             re                  zopeEnter any module name to get more help.  Or, type "modules spam" to searchfor modules whose descriptions contain the word "spam".

登录后复制

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。

发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2283681.html

(0)
上一篇 2025年2月27日 20:18:52
下一篇 2025年2月23日 01:34:08

AD推荐 黄金广告位招租... 更多推荐

相关推荐

  • python教程 python日期函数实例

    在python中对日期进行操作的库有:datetime、time 无论在哪种语言,日期函数肯定是最常用的函数。下面直接上实例代码 #datetimeimport datetime#当前日期now = datetime.datetime.no…

    编程技术 2025年2月27日
    000
  • python开发

    总结我们在平常开发过程中对字符串的一些操作: #字母大小写转换 #首字母转大写 #去除字符串中特殊字符(如:’_’,’.’,’,’,’;’),然…

    编程技术 2025年2月27日
    100
  • python同时给多个变量赋值

    同时赋多个值 以下是一种很酷的编程捷径:在 Python 中,可使用元组来一次 赋多值。 >>> v = (‘a’, 2, True) >>> (x, y, z) = v     …

    编程技术 2025年2月27日
    200
  • python线程池进一步认识

    线程池的概念是什么? 在面向对象编程中,创建和销毁对象是很费时间的,因为创建一个对象要获取内存资源或者其它更多资源。在Java中更是 如此,虚拟机将试图跟踪每一个对象,以便能够在对象销毁后进行垃圾回收。所以提高服务程序效率的一个手段就是尽可…

    编程技术 2025年2月27日
    200
  • Python Logging 模块研究

    背景 在一个新的项目里面加入了日志功能,想自己写一个,但是一个偶然的机会,通过google发现Python内建了一个非常强大的日志(log)模块:logging。粗略的研究了一下,下面是我的一些心得札记。 为什么使用日志 追踪程序的一些运行…

    编程技术 2025年2月27日
    200
  • 你所不知道的python 循环中的else

    众多语言中都有if else这对条件选择组合,但是在python中还有更多else使用的地方,比如说循环for,或者while都可以和else组合。 下面简单介绍一下for-else while-else组合 循环组合中的else执行的情况…

    编程技术 2025年2月27日
    100
  • Python全局变量与局部变量详解

    python全局变量与局部变量详解 #Python中的变量:全局变量和局部变量  #在很多语言中,在声明全局变量的时候,都喜欢把全局变量的名称定义为大写  #定义学生人数为100STUDENT_NUMBER = 100#学校名称SCHOOL…

    编程技术 2025年2月27日
    200
  • Python的类实例属性访问规则

    一般来说,在python中,类实例属性的访问规则算是比较直观的。 但是,仍然存在一些不是很直观的地方,特别是对C++和Java程序员来说,更是如此。 在这里,我们需要明白以下几个地方: 1.Python是一门动态语言,任何实体都可以动态地添…

    编程技术 2025年2月27日
    200
  • python encode和decode的妙用

    字符串解码: 有个字符串: ‘\u4fee\u6539\u8282\u70b9\u72b6\u6001\u6210\u529f’ 想转换为: u”u4feeu6539u8282u70b9u72b6u600…

    编程技术 2025年2月27日
    200
  • Python实用技巧总结

    以下是我近些年收集的一些python实用技巧和工具,希望能对你有所帮助。 交换变量 x = 6 y = 5 x, y = y, x 立即学习“Python免费学习笔记(深入)”; print x >>> 5 print y…

    编程技术 2025年2月27日
    200

发表回复

登录后才能评论