当前位置:Gxlcms > Python > 查看python的可用模块

查看python的可用模块

时间:2021-07-01 10:21:17 帮助过:32人阅读

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

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

$ python
Python 2.7.2 (default, Jan 19 2012, 18:26:31)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-51)] on linux2
Type "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 out
the tutorial on the Internet at http://docs.python.org/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, or topics, type "modules",
"keywords", or "topics".  Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".


>>> modules
Please 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             readability
BaseHTTPServer      _MozillaCookieJar   dummy_thread        readline
Bastion             __builtin__         dummy_threading     redis
BdfFontFile         __future__          easy_install        repr
BeautifulSoup       _abcoll             email               resource
BeautifulSoupTests  _ast                encodings           rexec
BmpImagePlugin      _bisect             engine              rfc822
BufrStubImagePlugin _codecs             errno               rlcompleter
CDROM               _codecs_cn          exceptions          robotparser
CGIHTTPServer       _codecs_hk          ext                 runpy
Canvas              _codecs_iso2022     fcntl               sched
ConfigParser        _codecs_jp          filecmp             scrapy
ContainerIO         _codecs_kr          fileinput           scrapyd
Cookie              _codecs_tw          fnmatch             select
Crypto              _collections        formatter           server
CurImagePlugin      _csv                fpformat            sets
DLFCN               _ctypes             fractions           setuptools
DcxImagePlugin      _ctypes_test        ftplib              sgmllib
Dialog              _curses             functools           sha
DocXMLRPCServer     _curses_panel       future_builtins     shelve
EpsImagePlugin      _elementtree        gc                  shlex
ExifTags            _functools          genericpath         shutil
FileDialog          _hashlib            getopt              signal
FitsStubImagePlugin _heapq              getpass             site
FixTk               _hotshot            gettext             six
FliImagePlugin      _imaging            glob                smtpd
FontFile            _imagingcms         grp                 smtplib
FpxImagePlugin      _imagingft          gzip                sndhdr
GbrImagePlugin      _imagingmath        hashlib             socket
GdImageFile         _io                 heapq               spwd
GifImagePlugin      _json               hmac                sql
GimpGradientFile    _locale             hotshot             sqlalchemy
GimpPaletteFile     _lsprof             htmlentitydefs      sqlite3
GribStubImagePlugin _md5                htmllib             sre
HTMLParser          _multibytecodec     httplib             sre_compile
Hdf5StubImagePlugin _multiprocessing    idlelib             sre_constants
IN                  _mysql              ihooks              sre_parse
IcnsImagePlugin     _mysql_exceptions   imaplib             ssl
IcoImagePlugin      _pyio               imghdr              stat
ImImagePlugin       _random             imp                 statvfs
Image               _sha                importlib           string
ImageChops          _sha256             imputil             stringold
ImageCms            _sha512             inspect             stringprep
ImageColor          _socket             io                  strop
ImageDraw           _sre                itertools           struct
ImageDraw2          _ssl                json                subprocess
ImageEnhance        _strptime           keyword             sunau
ImageFile           _struct             lib2to3             sunaudio
ImageFileIO         _symtable           linecache           symbol
ImageFilter         _testcapi           linuxaudiodev       symtable
ImageFont           _threading_local    locale              sys
ImageGL             _warnings           logging             sysconfig
ImageGrab           _weakref            lxml                syslog
ImageMath           _weakrefset         macpath             tabnanny
ImageMode           _yappi              macurl2path         tarfile
ImageOps            abc                 mailbox             telnetlib
ImagePalette        aifc                mailcap             tempfile
ImagePath           antigravity         markupbase          termios
ImageQt             anydbm              marshal             test
ImageSequence       argparse            math                tests
ImageShow           array               mcrypt              textwrap
ImageStat           ast                 md5                 this
ImageTk             asynchat            mhlib               thread
ImageTransform      asyncore            mimetools           threading
ImageWin            atexit              mimetypes           thrift
ImtImagePlugin      audiodev            mimify              time
IptcImagePlugin     audioop             mmap                timeit
JpegImagePlugin     base64              modulefinder        tkColorChooser
McIdasImagePlugin   bdb                 multifile           tkCommonDialog
MicImagePlugin      binascii            multiprocessing     tkFileDialog
MimeWriter          binhex              mutex               tkFont
MpegImagePlugin     bisect              netrc               tkMessageBox
MspImagePlugin      bsddb               new                 tkSimpleDialog
MySQLdb             bz2file             nis                 toaiff
OleFileIO           cPickle             nltk                token
OpenSSL             cProfile            nntplib             tokenize
PIL                 cStringIO           ntpath              tornado
PSDraw              calendar            nturl2path          trace
PaletteFile         cgi                 numbers             traceback
PalmImagePlugin     cgitb               opcode              transport
PcdImagePlugin      chardet             operator            ttk
PcfFontFile         chunk               optparse            tty
PcxImagePlugin      cmath               orm                 turtle
PdfImagePlugin      cmd                 os                  twisted
PixarImagePlugin    code                os2emxpath          types
PngImagePlugin      codecs              ossaudiodev         unicodedata
PpmImagePlugin      codeop              parser              unittest
PsdImagePlugin      collections         pdb                 urllib
Queue               colorsys            pickle              urllib2
ScrolledText        command             pickletools         urlparse
SgiImagePlugin      commands            pip                 user
SimpleDialog        compileall          pipes               util
SimpleHTTPServer    compiler            pkg_resources       uu
SimpleXMLRPCServer  connectors          pkgutil             uuid
SocketServer        constants           platform            virtualenv
SpiderImagePlugin   contextlib          plistlib            virtualenv_support
StringIO            cookielib           popen2              w3lib
SunImagePlugin      copy                poplib              warnings
TYPES               copy_reg            posix               wave
TarIO               crypt               posixfile           weakref
TgaImagePlugin      csv                 posixpath           web
TiffImagePlugin     ctypes              pprint              webbrowser
TiffTags            curses              profile             whichdb
Tix                 databases           protocol            wsgiref
Tkconstants         datetime            pstats              xdrlib
Tkdnd               dateutil            pty                 xml
Tkinter             dbhash              pwd                 xmllib
UserDict            decimal             py_compile          xmlrpclib
UserList            dialects            pyclbr              xxsubtype
UserString          difflib             pydoc               yaml
WalImageFile        dircache            pydoc_data          yappi
WmfImagePlugin      dis                 pyexpat             zipfile
XVThumbImagePlugin  distutils           quopri              zipimport
XbmImagePlugin      django              random              zlib
XpmImagePlugin      doctest             re                  zope

Enter any module name to get more help.  Or, type "modules spam" to search
for modules whose descriptions contain the word "spam".

人气教程排行