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