pythonpydoc是什么
pythonpydoc是什么
1、说明
Python自带的pydoc模块,可以非常方便地查看、生成帮助文档,该文档是HTML格式的,因此查看、使用起来非常方便。
2、作用
(1)生成文本格式的注释文档
importpydoc
importsys
withopen('aa.txt','w')asf:
pydoc.doc('bin.socketServer',output=f)
(2)使用help()函数,生成的是文本格式的文档
importpydoc
importsys
#help()==pydoc.help()==pydoc.doc()
sys.stdout=open('aa.txt','w')
help('bin.socketServer')
sys.stdout.close()
#sys.stdout的作用是将输出到控制台的内容写
#入文件
#问题1:help函数会生成每一个类所有父类的注释文档,所有公共父类会重复生成很多次注释,
3、启动方法
pydoc启动服务器和浏览器的方法为,在console中输入命令:
python-mpydoc-b
上述命令的m参数表示:查看module在当前的可见的搜索路径上;b表示启动的是浏览器。
在我的Anoconda中python3.4环境下使用上述命令。
以上就是pythonpydoc的基本介绍,在查看和生成文档方面,我们很多时候都是需要依赖pydoc模块的使用。更多Python学习教程请关注IT培训机构:千锋教育。

猜你喜欢LIKE
相关推荐HOT
更多>>
python中open和with open有什么区别?
python中open和withopen有什么区别?本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。一、open函数一般是使用open()和close()组合来...详情>>
2023-11-10 23:40:58
python中使用_setattr_()
python中使用_setattr_()本文教程操作环境:windows7系统、Python3.9.1,DELLG3电脑。1、setattr函数给对象的属性赋值,若属性不存在,先创建再...详情>>
2023-11-10 22:45:02
python中如何使用np.delete()方法?
python中如何使用np.delete()方法?在python列表中,如果我们想要删除一个或者连续几个元素,可以使用del()方法,在numpy数组,如果想要删除元素...详情>>
2023-11-10 21:40:05
python中ndarray是什么?
python中ndarray是什么?在使用python的Numpy数组,时,我们总会遇到ndarray,那ndarray是什么呢?ndarray是Numpy中的一个多维数组的数据结构,在...详情>>
2023-11-10 20:08:58热门推荐
python中open和with open有什么区别?
沸python中jsonpath模块有何用法?
热python中使用_setattr_()
热如何使用Python的telnetlib模块?
新python中如何使用np.delete()方法?
python中wordcloud库如何生成词云?
python中ndarray与list转换的方法
python中ndarray是什么?
python套接字的用法
python中如何使用@contextmanage?
Python IDE之Thonny的介绍
python如何安装OpenCV?
python如何实现信息增益和信息增益率
pythonpickle模块的使用注意
技术干货






