python自带help功能怎么使用

免费教程   2024年04月19日 4:07  

这篇“python自带help功能怎么使用”文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容,内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“python自带help功能怎么使用”文章吧。

help使用C:\Users\wusong>pythonPython3.8.2rc1(tags/v3.8.2rc1:8623e68,Feb112020,10:46:21)[MSCv.191664bit(AMD64)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>

输入help()

>>>helpTypehelp()forinteractivehelp,orhelp(object)forhelpaboutobject.>>>help()WelcometoPython3.8'shelputility!IfthisisyourfirsttimeusingPython,youshoulddefinitelycheckoutthetutorialontheInternetathttps://docs.python.org/3.8/tutorial/.Enterthenameofanymodule,keyword,ortopictogethelponwritingPythonprogramsandusingPythonmodules.Toquitthishelputilityandreturntotheinterpreter,justtype"quit".Togetalistofavailablemodules,keywords,symbols,ortopics,type"modules","keywords","symbols",or"topics".Eachmodulealsocomeswithaone-linesummaryofwhatitdoes;tolistthemoduleswhosenameorsummarycontainagivenstringsuchas"spam",type"modulesspam".help>

这句话:To get a list of available modules, keywords, symbols, or topics, type "modules", "keywords", "symbols", or "topics".

意思就是:

要获取可用模块、关键字、符号或主题的列表,请键入 “模块”、“关键字”、“符号”或“主题”。

modules

我们先看下modules

在help模式下输入:modules

help>modulesPleasewaitamomentwhileIgatheralistofallavailablemodules...D:\software_install\python\lib\pkgutil.py:92:UserWarning:Thenumpy.array_apisubmoduleisstillexperimental.SeeNEP47.__import__(info.name)PILasyncpgidnaseleniumPyInstalleratexitimaplibserialPyQt5atlastkimghdrsetuptools__future__attrimpshelve_abcattrsimportlibshlex_astaudioopinspectshutil_asynciobackportsiosignal_bisectbase64ipaddresssimplejson_blake2bcryptitertoolssite_bootlocalebdbjinja2six_bz2billiardjsonsmtpd_cffi_backendbinasciikeywordsmtplib_codecsbinhexkiwisolversndhdr_codecs_cnbisectkombusniffio_codecs_hkbroadcasterlib2to3socket_codecs_iso2022builtinslibfuturizesocketserver_codecs_jpbz2libpasteurizesocks_codecs_krcProfilelinecachesockshandler_codecs_twcalendarlocalesortedcontainers_collectionsceleryloggingsqlalchemy_collections_abccertifilogurusqlite3_compat_picklecffilzmasqlparse_compressioncgimailboxsre_compile_contextvarscgitbmailcapsre_constants_csvcharset_normalizermarkupsafesre_parse_ctypeschunkmarshalssl_ctypes_testclickmathstarlette_datetimeclick_didyoumeanmatplotlibstat_decimalclick_pluginsmimetypesstatistics_dummy_threadclick_replmmapstring_elementtreecmathmodulefinderstringprep_functoolscmdmsilibstruct_hashlibcodemsvcrtsubprocess_heapqcodecsmultiprocessingsunau_impcodeopnaclsymbol_iocollectionsnetrcsymtable_jsoncoloramanntplibsys_localecolorsysntsysconfig_lsprofcompileallntpathtabnanny_lzmaconcurrentnturl2pathtarfile_markupbaseconfigparsernumberstelnetlib_md5contextlibnumpytempfile_msicontextvarsopcodetest_multibytecodeccontourpyoperatortextwrap_multiprocessingcopyoptparsetftpy_opcodecopyregordered_setthis_operatorcryptordlookupthreading_osx_supportcryptographyostime_overlappedcsvoutcometimeit_picklectypespackagingtkinter_py_abccursesparamikotoken_pydecimalcv2parsertokenize_pyinstaller_hooks_contribcyclerpasttortoise_pyiodatabasespathlibtrace_queuedataclassespdbtraceback_randomdatetimepefiletracemalloc_ruamel_yamldateutilpeutilstrio_sha1dbmpickletrio_websocket_sha256decimalpickletoolstty_sha3deepdiffpipturtle_sha512difflibpipesturtledemo_signaldispkg_resourcestypes_sitebuiltinsdistlibpkgutiltyping_socketdistutilsplatformtyping_extensions_sqlite3djangoplatformdirstzdata_sredoctestplistlibunicodedata_ssldotenvpoplibunittest_statdummy_threadingposixpathurllib_statisticseasy_installpprinturllib3_stringemailprettytableuu_strptimeencodingsprofileuuid_structensurepipprompt_toolkituvicorn_symtableenumpstatsvenv_testbuffererrnopsutilvine_testcapifastapiptyvirtualenv_testconsolefaulthandlerpy_compilewarnings_testimportmultiplefilecmppyclbrwatchfiles_testmultiphasefileinputpycparserwave_threadfilelockpydanticwcwidth_threading_localfnmatchpydocweakref_tkinterfontToolspydoc_datawebbrowser_tracemallocformatterpyechartswebsockets_warningsfractionspyexpatwin32_setctime_weakrefftplibpylabwin32ctypes_weakrefsetfunctoolspyparsingwinreg_winapifuturepyqt5_pluginswinsound_xxsubinterpretersgcpyqt5_toolswsgiref_yamlgenericpathpytzwsprotoabcgetoptqt5_applicationsxdrlibaifcgetpassqt5_toolsxlrdaltgraphgettextqueuexlwtamqpglobquoprixmlantigravitygreenletrandomxmlrpcanyiogziprexxsubtypeargparseh21reprlibyamlarrayhashlibrequestszipappasgirefheapqrlcompleterzipfileasthmacrunpyzipimportasync_generatorhtmlschedzlibasynchathttpsecretsasynciohttptoolsselectasyncoreidlelibselectorsEnteranymodulenametogetmorehelp.Or,type"modulesspam"tosearchformoduleswhosenameorsummarycontainthestring"spam".help>

从这里可以看出还是有相当多的模块,比如我们常用的re,xlrd当然也有我们后期安装的;挑一个进去看看,有啥风景,就挑xlrd

help>xlrdHelponpackagexlrd:NAMExlrdDESCRIPTION#Copyright(c)2005-2012StephenJohnMachin,LingfoPtyLtd#Thismoduleispartofthexlrdpackage,whichisreleasedundera#BSD-stylelicence.PACKAGECONTENTSbiffhbookcompdocformattingformulainfosheettimemachinexldateFUNCTIONScount_records(filename,outfile=<colorama.ansitowin32.StreamWrapperobjectat0x000001D26AC13D00>)Fordebuggingandanalysis:summarisethefile'sBIFFrecords.ie:produceasortedfileof``(record_name,count)``.:paramfilename:Thepathtothefiletobesummarised.:paramoutfile:Anopenfile,towhichthesummaryiswritten.--More--行数:

这里面会详细介绍xlrd模块的名字,描述,模块目录、功能、版本、文件位置等信息,在最后一行看到-- More -- ,这是一个分页符,表示当前页面不能全部显示所有信息,需要部分分页操作,可以使用空格键切换下一页,也可以使用回车键看下一行,看你自己的需求进行操作,如果不想看了可输入q退出阅读模式,进入help模式,再输入q则可以继续退出help模式;

help>qYouarenowleavinghelpandreturningtothePythoninterpreter.Ifyouwanttoaskforhelponaparticularobjectdirectlyfromtheinterpreter,youcantype"help(object)".Executing"help('string')"hasthesameeffectastypingaparticularstringatthehelp>prompt.>>>keywords

再看下我们后面会常说的关键字

help>keywordsHereisalistofthePythonkeywords.Enteranykeywordtogetmorehelp.FalseclassfromorNonecontinueglobalpassTruedefifraiseanddelimportreturnaselifintryassertelseiswhileasyncexceptlambdawithawaitfinallynonlocalyieldbreakfornotsymbols

这个是罗列了我们在python语言中涉及的运算符

help>symbolsHereisalistofthepunctuationsymbolswhichPythonassignsspecialmeaningto.Enteranysymboltogetmorehelp.!=+<=__"+=<>`""",==b"%->b'%=-=>=f"&.>>f'&=...>>=j'/@r"'''//Jr'(//=[u")/=\u'*:]|**<^|=**=<<^=~*=<<=_

以上就是关于“python自带help功能怎么使用”这篇文章的内容,相信大家都有了一定的了解,希望小编分享的内容对大家有帮助,若想了解更多相关的知识内容,请关注行业资讯频道。

域名注册
购买VPS主机

您或许对下面这些文章有兴趣:                    本月吐槽辛苦排行榜

看贴要回贴有N种理由!看帖不回贴的后果你懂得的!


评论内容 (*必填):
(Ctrl + Enter提交)   

部落快速搜索栏

各类专题梳理

网站导航栏

X
返回顶部