admin 发表于 2017-9-28 14:16:26

python下help()使用方法

查看python所有的modules:help("modules")单看python所有的modules中包含指定字符串的modules: help("modules yourstr")查看python中常见的topics: help("topics")查看python标准库中的module:import os.path + help("os.path")查看python内置的类型:help("list")查看python类型的成员方法:help("str.find") 查看python内置函数:help("open")
举例:>>> help("modules")
Please wait a moment while I gather a list of all available modules...
1                   abc               html                setuptools__future__          aifc                http                shelve_ast                antigravity         idlelib             shlex_bisect             argparse            imaplib             shutil_bootlocale         array               imghdr            signal_bz2                ast               imp               site_codecs             asynchat            importlib         smtpd_codecs_cn          asyncio             inspect             smtplib_codecs_hk          asyncore            io                  sndhdr_codecs_iso2022   atexit            ipaddress         socket_codecs_jp          audioop             itertools         socketserver_codecs_kr          base64            json                sqlite3_codecs_tw          bdb               keyword             sre_compile_collections      binascii            lib2to3             sre_constants_collections_abc    binhex            linecache         sre_parse_compat_pickle      bisect            locale            ssl_compression      builtins            logging             stat_csv                bz2               lzma                statistics_ctypes             cProfile            macpath             string_ctypes_test      calendar            macurl2path         stringprep_datetime         cgi               mailbox             struct_decimal            cgitb               mailcap             subprocess_dummy_thread       chunk               marshal             sunau_elementtree      cmath               math                symbol_functools          cmd               mimetypes         symtable_hashlib            code                mmap                sys_heapq            codecs            modulefinder      sysconfig_imp                codeop            msilib            tabnanny_io               collections         msvcrt            tarfile_json               colorsys            multiprocessing   telnetlib_locale             compileall          netrc               tempfile_lsprof             concurrent          nntplib             test_lzma               configparser      nt                  textwrap_markupbase         contextlib          ntpath            this_md5                copy                nturl2path          threading_msi                copyreg             numbers             time_multibytecodec   crypt               opcode            timeit_multiprocessing    csv               operator            tkinter_opcode             ctypes            optparse            token_operator         curses            os                  tokenize_osx_support      datetime            parser            trace_overlapped         dbm               pathlib             traceback_pickle             decimal             pdb               tracemalloc_pydecimal          difflib             pickle            tty_pyio               dis               pickletools         turtle_random             distutils         pip               turtledemo_sha1               doctest             pipes               types_sha256             dummy_threading   pkg_resources       typing_sha512             easy_install      pkgutil             unicodedata_signal             email               platform            unittest_sitebuiltins       encodings         plistlib            urllib_socket             ensurepip         poplib            uu_sqlite3            enum                posixpath         uuid_sre                errno               pprint            venv_ssl                faulthandler      profile             warnings_stat               filecmp             pstats            wave_string             fileinput         pty               weakref_strptime         fnmatch             py_compile          webbrowser_struct             formatter         pyclbr            winreg_symtable         fractions         pydoc               winsound_testbuffer         ftplib            pydoc_data          wsgiref_testcapi         functools         pyexpat             xdrlib_testimportmultiple gc                  queue               xml_testmultiphase   genericpath         quopri            xmlrpc_thread             getopt            random            xxsubtype_threading_local    getpass             re                  zipapp_tkinter            gettext             reprlib             zipfile_tracemalloc      glob                rlcompleter         zipimport_warnings         gzip                runpy               zlib_weakref            hashlib             sched_weakrefset         heapq               select_winapi             hmac                selectors
Enter any module name to get more help.Or, type "modules spam" to searchfor modules whose name or summary contain the string "spam".
举例:查看某个模块的具体使用帮助:>>> help("linecache")Help on module linecache:
NAME    linecache - Cache lines from Python source files.
DESCRIPTION    This is intended to read lines from modules imported -- hence if a filename    is not found, it will look down the module search path for a file by    that name.
FUNCTIONS    checkcache(filename=None)      Discard cache entries that are out of date.      (This is not checked upon each call!)
    clearcache()      Clear the cache entirely.
    getline(filename, lineno, module_globals=None)
DATA    __all__ = ['getline', 'clearcache', 'checkcache']
FILE    c:\python3.5\lib\linecache.py
页: [1]
查看完整版本: python下help()使用方法