python自带help功能如何使用


这篇文章主要介绍“python自带help功能如何使用”,在日常操作中,相信很多人在python自带help功能如何使用问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”python自带help功能如何使用”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

python help使用

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

输入help()

>>>helpTypehelp()forinteractivehelp,orhelp(object)forhelpaboutobject.>>>help()WeetoPython3.8'shelputility!IfthisisyourfirsttimeusingPython,youshoulddefinitelycheckoutthetutorialontheInternetatdocs.python.org/3.8/tutorial/.Enterthenameofanymodule,keyword,ortopictogethelponwritingPythonprogramsandusingPythonmodules.Toquitthishelputilityandreturntotheinterpreter,justtype"quit".Togetalistofavailablemodules,keywords,symbols,ortopics,type"modules","keywords","symbols",or"topics".Eachmodulealso&nbspeswithaone-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_codecsbisectkombusniffio_codecs_hkbroadcasterlib2to3socket_codecs_iso2023builtinslibfuturizesocketserver_codecs_jpbz2libpasteurizesocks_codecs_krcProfilelinecachesockshandler_codecs_twcalendarlocalesortedcontainers_collectionsceleryloggingsqlalchemy_collections_abccertifilogurusqlite3pat_picklecffilzmasqlparsepressioncgimailboxsrepile_contextvarscgitbmailcapsre_constants_csvcharset_normalizermarkupsafesre_parse_ctypeschunkmarshalssl_ctypes_testclickmathstarlette_datetimeclick_didyoumeanmatplotlibstat_decimalclick_pluginsmimetypesstatistics_dummy_threadclick_replmmapstring_elementtreecmathmodulefinderstringprep_functoolscmdmsilibstruct_hashlibcodemsvcrtsubprocess_heapqcodecsmultiprocessingsunau_impcodeopnaclsymbol_iocollectionsnetrcsymtable_jsoncoloramanntplibsys_localecolorsysntsysconfig_lsprof&nbsppileallntpathtabnanny_lzmaconcurrentnturl2pathtarfile_markupbaseconfigparsernumberstelnetlib_md5contextlibnumpytempfile_msicontextvarsopcodetest_multibytecodeccontourpyoperatortextwrap_multiprocessingcopyoptparsetftpy_opcodecopyregordered_setthis_operatorcryptordlookupthreading_osx_supportcryptographyostime_overlappedcsvouetimeit_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_testconsolefaulthandlerpypilewarnings_testimportmultiplefilecmppyclbrwatchfiles_testmultiphasefileinputpycparserwave_threadfilelockpydanticwcwidth_threading_localfnmatchpydocweakref_tkinterfontToolspydoc_datawebbrowser_tracemallocformatterpyechartswebsockets_warningsfractionspyexpatwin32_setctime_weakrefftplibpylabwin32ctypes_weakrefsetfunctoolspyparsingwinreg_winapifuturepyqt5_pluginswinsound_xxsubinterpretersgcpyqt5_toolswsgiref_yamlgenericpathpytzwsprotoabcgetoptqt5_applicationsxdrlibaifcgetpassqt5_toolsxlrdaltgraphgettextqueuexlwtamqpglobquoprixmlantigravitygreenletrandomxmlrpcanyiogziprexxsubtypeargparseh21reprlibyamlarrayhashlibrequestszipappasgirefheapqrpleterzipfileasthmacrunpyzipimportasync_generatorhtmlschedzlibasynchathttpsecretsasynciohttptoolsselectasyncoreidlelibselectorsEnteranymodulenametogetmorehelp.Or,type"modulesspam"tosearchformoduleswhosenameorsummarycontainthestring"spam".help>

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

help>xlrdHelponpackagexlrd:NAMExlrdDESCRIPTION#Copyright(c)2005-2012StephenJohnMachin,LingfoPtyLtd#Thismoduleispartofthexlrdpackage,whichisreleasedundera#BSD-stylelicence.PACKAGECONTENTSbiffhbook&nbsppdocformattingformulainfosheettimemachinexldateFUNCTIONScount_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.FalseclassfromorNonecontinueglobalpassTruedefifraiseanddelimportreturnaselifintryassertelseiswhileasyncexceptlambdawithawaitfinallynonlocalyieldbreakfornot

symbols

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

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

到此,关于“python自带help功能如何使用”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注主机评测网网站,小编会继续努力为大家带来更多实用的文章!


上一篇:怎么使用vue-pdf插件实现pdf文档预览功能

下一篇:Python怎么绘制Matplotlib散点图


Copyright © 2002-2019 测速网 https://www.inhv.cn/ 皖ICP备2023010105号 城市 地区 街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!
热门搜索