这篇“python自带help功能怎么使用”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“python自带help功能怎么使用”文章吧。
python help使用
C:\Users\wusong>pythonPython 3.8.2rc1 (tags/v3.8.2rc1:8623e68, Feb 11 2020, 10:46:21) [MSC v.1916 64 bit (AMD64)] on win32Type "help", "copyright", "credits" or "license" for more information.>>>
输入help()
>>> helpType help() for interactive help, or help(object) for help about object.>>> help()Welcome to Python 3.8's help utility!If this is your first time using Python, you should definitely check outthe tutorial on the Internet at https://docs.python.org/3.8/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, symbols, or topics, type"modules", "keywords", "symbols", or "topics". Each module also comeswith a one-line summary of what it does; to list the modules whose nameor summary contain a given string such as "spam", type "modules spam".help>
这句话:To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics".
意思就是:
要获取可用模块、关键字、符号或主题的列表,请键入 “模块”、“关键字”、“符号”或“主题”。
modules
我们先看下modules
在help模式下输入:modules
help> modulesPlease wait a moment while I gather a list of all available modules...D:\software_install\python\lib\pkgutil.py:92: UserWarning: The numpy.array_api submodule is still experimental. See NEP 47. __import__(info.name)PIL asyncpg idna seleniumPyInstaller atexit imaplib serialPyQt5 atlastk imghdr setuptools__future__ attr imp shelve_abc attrs importlib shlex_ast audioop inspect shutil_asyncio backports io signal_bisect base64 ipaddress simplejson_blake2 bcrypt itertools site_bootlocale bdb jinja2 six_bz2 billiard json smtpd_cffi_backend binascii keyword smtplib_codecs binhex kiwisolver sndhdr_codecs_cn bisect kombu sniffio_codecs_hk broadcaster lib2to3 socket_codecs_iso2022 builtins libfuturize socketserver_codecs_jp bz2 libpasteurize socks_codecs_kr cProfile linecache sockshandler_codecs_tw calendar locale sortedcontainers_collections celery logging sqlalchemy_collections_abc certifi loguru sqlite3_compat_pickle cffi lzma sqlparse_compression cgi mailbox sre_compile_contextvars cgitb mailcap sre_constants_csv charset_normalizer markupsafe sre_parse_ctypes chunk marshal ssl_ctypes_test click math starlette_datetime click_didyoumean matplotlib stat_decimal click_plugins mimetypes statistics_dummy_thread click_repl mmap string_elementtree cmath modulefinder stringprep_functools cmd msilib struct_hashlib code msvcrt subprocess_heapq codecs multiprocessing sunau_imp codeop nacl symbol_io collections netrc symtable_json colorama nntplib sys_locale colorsys nt sysconfig_lsprof compileall ntpath tabnanny_lzma concurrent nturl2path tarfile_markupbase configparser numbers telnetlib_md5 contextlib numpy tempfile_msi contextvars opcode test_multibytecodec contourpy operator textwrap_multiprocessing copy optparse tftpy_opcode copyreg ordered_set this_operator crypt ordlookup threading_osx_support cryptography os time_overlapped csv outcome timeit_pickle ctypes packaging tkinter_py_abc curses paramiko token_pydecimal cv2 parser tokenize_pyinstaller_hooks_contrib cycler past tortoise_pyio databases pathlib trace_queue dataclasses pdb traceback_random datetime pefile tracemalloc_ruamel_yaml dateutil peutils trio_sha1 dbm pickle trio_websocket_sha256 decimal pickletools tty_sha3 deepdiff pip turtle_sha512 difflib pipes turtledemo_signal dis pkg_resources types_sitebuiltins distlib pkgutil typing_socket distutils platform typing_extensions_sqlite3 django platformdirs tzdata_sre doctest plistlib unicodedata_ssl dotenv poplib unittest_stat dummy_threading posixpath urllib_statistics easy_install pprint urllib3_string email prettytable uu_strptime encodings profile uuid_struct ensurepip prompt_toolkit uvicorn_symtable enum pstats venv_testbuffer errno psutil vine_testcapi fastapi pty virtualenv_testconsole faulthandler py_compile warnings_testimportmultiple filecmp pyclbr watchfiles_testmultiphase fileinput pycparser wave_thread filelock pydantic wcwidth_threading_local fnmatch pydoc weakref_tkinter fontTools pydoc_data webbrowser_tracemalloc formatter pyecharts websockets_warnings fractions pyexpat win32_setctime_weakref ftplib pylab win32ctypes_weakrefset functools pyparsing winreg_winapi future pyqt5_plugins winsound_xxsubinterpreters gc pyqt5_tools wsgiref_yaml genericpath pytz wsprotoabc getopt qt5_applications xdrlibaifc getpass qt5_tools xlrdaltgraph gettext queue xlwtamqp glob quopri xmlantigravity greenlet random xmlrpcanyio gzip re xxsubtypeargparse h21 reprlib yamlarray hashlib requests zipappasgiref heapq rlcompleter zipfileast hmac runpy zipimportasync_generator html sched zlibasynchat http secretsasyncio httptools selectasyncore idlelib selectorsEnter any module name to get more help. Or, type "modules spam" to searchfor modules whose name or summary contain the string "spam".help>
从这里可以看出还是有相当多的模块,比如我们常用的re
,xlrd
当然也有我们后期安装的;挑一个进去看看,有啥风景,就挑xlrd
help> xlrdHelp on package xlrd:NAME xlrdDESCRIPTION # Copyright (c) 2005-2012 Stephen John Machin, Lingfo Pty Ltd # This module is part of the xlrd package, which is released under a # BSD-style licence.PACKAGE CONTENTS biffh book compdoc formatting formula info sheet timemachine xldateFUNCTIONS count_records(filename, outfile=<colorama.ansitowin32.StreamWrapper object at 0x000001D26AC13D00>) For debugging and analysis: summarise the file's BIFF records. ie: produce a sorted file of ``(record_name, count)``. :param filename: The path to the file to be summarised. :param outfile: An open file, to which the summary is written.-- More -- 行数:
这里面会详细介绍xlrd
模块的名字,描述,模块目录、功能、版本、文件位置等信息,在最后一行看到-- More --
,这是一个分页符,表示当前页面不能全部显示所有信息,需要部分分页操作,可以使用空格键切换下一页,也可以使用回车键看下一行,看你自己的需求进行操作,如果不想看了可输入q
退出阅读模式,进入help模式,再输入q
则可以继续退出help模式;
help> qYou are now leaving help and returning to the Python interpreter.If you want to ask for help on a particular object directly from theinterpreter, you can type "help(object)". Executing "help('string')"has the same effect as typing a particular string at the help> prompt.>>>
keywords
再看下我们后面会常说的关键字
help> keywordsHere is a list of the Python keywords. Enter any keyword to get more help.False class from orNone continue global passTrue def if raiseand del import returnas elif in tryassert else is whileasync except lambda withawait finally nonlocal yieldbreak for not
symbols
这个是罗列了我们在python语言中涉及的运算符
help> symbolsHere is a list of the punctuation symbols which Python assigns special meaningto. Enter any symbol to get more help.!= + <= __" += <> `""" , == b"% - > b'%= -= >= f"& . >> f'&= ... >>= j' / @ r"''' // J r'( //= [ u") /= \ u'* : ] |** < ^ |=**= << ^= ~*= <<= _
以上就是关于“python自带help功能怎么使用”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注编程网行业资讯频道。