首页 > 编程语言 >python pydoc模块生成html网页版内容

python pydoc模块生成html网页版内容

时间:2023-07-06 19:12:11浏览次数:43  
标签:python documentation module pydoc html port

pydoc 是一个能生成网页版的模块,内置模块

命令:

python -m pydoc -p 1234

-m 加载模块
-p 网页访问端口


命令行:
image

b 打开浏览器
q 退出


效果:
image


Windows环境下:

python -m pydoc -w atexit   //在当前目录创建atexit.html
python -m pydoc -p 5000    //启动一个Web服务器监听http://localhost:5000/

Linux环境下:

pydoc -w atexit
pydoc -p 5000



说明&参数:

python3 -m pydoc
pydoc - the Python documentation tool

pydoc <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '/', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

pydoc -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

pydoc -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

pydoc -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  The -p option can be used with
    the -b option to explicitly specify the server port.

pydoc -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '/', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.


--
参考:
https://baijiahao.baidu.com/s?id=1747269705228787388&wfr=spider&for=pc
http://www.manongjc.com/detail/51-wxogbwvataghipj.html


标签:python,documentation,module,pydoc,html,port
From: https://www.cnblogs.com/wutou/p/17533090.html

相关文章

  • CPython, Pypy, MicroPython...还在傻傻分不清楚?
    哈喽大家好,我是咸鱼当我们说Python时,通常指的是官方实现的CPython但还有很多比如Pypy、Jython、MicroPython、Brython、RustPython等“python”许多小伙伴看到这些带“python”的概念可能一头雾水,心想这跟我平时接触到的python有什么区别吗?这些到底是什么那么今天这......
  • poi-tl 将html代码渲染到word中
    引入依赖<dependency><groupId>org.jsoup</groupId><artifactId>jsoup</artifactId><version>1.15.3</version></dependency><dependency><groupId>io.github.draco1023</groupId>......
  • Python如何实现docstring
    docPython语言从排版上看强制要求了一些书写规范,算是强制赋予了每个程序员一个"代码洁癖"。作为规范的一部分,可以在在类函数的开始增加注释,并且语言本身为这种注释做了"背书":可以通过help展示这个帮助文档的内容。这个本来是Python一个很细小的功能,也是一个很有意思的语法糖(因......
  • Python3读写TOML文件
    TOML(Tom'sObvious,MinimalLanguage)是一种易于阅读和编写的配置文件格式。它的设计目标是提供一种简单而灵活的方式来表示配置数据,以便于人类阅读和编辑。基础示例#config.toml[server]host="localhost"port=8080[database]name="mydb"user="myuser"passwor......
  • Python常用命令总结
    1.print()默认是print(end='\n')  如果不想换行可以print(end='')2.使print内容变成一行print(end='\t')3.不设置指定位置,按默认顺序"{}{}".format("hello","world")  eg打印99乘法表print({}*{}={}\t'.format(i,j,i*j),end......
  • 2. HTML 进阶之HTTP请求
    1)请求组成请求由三部分组成请求行请求头请求体可以用telnet程序测试2)请求方式与数据格式get请求示例GET/test2?name=%E5%BC%A0&age=20HTTP/1.1Host:localhost%E5%BC%A0是【张】经过URL编码后的结果post请求示例POST/test2HTTP/1.1Host:localho......
  • python 并发编程之线程
    一、队列的使用1、在python中,内置的有一个类,Queue就是队列2、队列的使用frommultiprocessingimportQueueif__name__=='__main__':q=Queue(3)#队列的大小默认很大#1.如何入队、"""obj,block=True,timeout=None"""q.put('hellow......
  • Python 异常处理(转载)
    Python异常处理什么是异常异常就是程序运行时发生错误的信号(在程序出现错误时,则会产生一个异常,若程序没有处理它,则会抛出该异常,程序的运行也随之终止),在python中,错误触发的异常如下语法错误这种错误,根本过不了python解释器的语法检测,必须在程序执行前就改正#语法错误示......
  • 在html中使用vConsole
    在vue中可以自行安装vConsole,那么移动端怎么办呢<scriptsrc="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script><script>varvConsole=newVConsole();console.log('Helloworld');</script......
  • python基础 如何查看进程的id号、队列的使用(queue)、解决进程之间隔离关系、生产者消
    如何查看进程id号进程都有几个属性:进程名、进程id号(pid-->processid)每一个进程都有一个唯一的id号,通过这个id号就能找到这个进程importosimporttimedeftask():print("task中的子进程号:",os.getpid())print("主进程中的进程号:",os.getppid())#parent......