• 可爱的Python_课后习题_CDay0 时刻准备着!发布


    请根据软件发布的流程和软件开发的编码规范,将读者在前面章节所写的程序修改并发 布出去。另外,可以查找下除了 epydoc 外还有哪些较好的 py 文档生成器? 

    pydoc是Python自带的模块,主要用于从python模块中自动生成文档,这些文档可以基于文本呈现的、也可以生成WEB 页面的,还可以在服务器上以浏览器的方式呈现!

    [用法]

    Windows下:

    D:>python -m pydoc # 比如说: python -m pydoc math 
    -m参数:Python以脚本的方法运行模块

    [帮助]

    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 -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.

    python代码(Test.py):

    #encoding=utf-8
    
    """
    进行堆栈的操作
    """
    
    __authors__= "test"
    
    class Stack:
        """堆栈"""
        items = list()
    
        def put(self, item):
            """将数据压入堆栈中"""
            self.items.append(item)
    
    
        def get(self):
            """将数据从堆栈中取出"""
            length = len(self.items)
            item = self.items[length-1]
            self.items.remove(item)
            return item

    cmd  中输入  D:LearnPython> python -m pydoc Test 

     

    Help on module Test:

     

    NAME

        Test - 进行堆栈的操作

     

    FILE

        /Users/jiajie.djj/workbench/zhu/Test.py

     

    CLASSES

        Stack

        

        class Stack

         |  堆栈

         |  

         |  Methods defined here:

         |  

         |  get(self)

         |      将数据从堆栈中取出

         |  

         |  put(self, item)

         |      将数据压入堆栈中

         |  

         |  ----------------------------------------------------------------------

     

     

     |  ----------------------------------------------------------------------

         |  Data and other attributes defined here:

         |  

         |  items = []

     

    DATA

        __authors__ = 'test'

     

     

    cmd 中输入 D:LearnPython> python -m pydoc -w Test Test.html

     

     

     

     

  • 相关阅读:
    【批处理】批处理遍历指定文件夹下的文件
    Win10删除文件显示删除确认对话框
    【makefile】make程序的命令行选项和参数
    【批处理】获取当前目录的绝对路径
    Win10怎样显示此电脑
    单片机普通行列矩阵键盘驱动
    ADS1.2与MDK4.7冲突问题的解决方法
    Cortex-M3 咬尾中断 与 晚到中断
    Cortex-M3 SVC与PendSV
    安卓渗透测试工具——Drozer(安装和使用)
  • 原文地址:https://www.cnblogs.com/zhuhaiying/p/6209360.html
Copyright © 2020-2023  润新知