Skip to content

printTable

命令行工具数据可视化


API说明

sunday.core.printTable(titleArr=[], align=None, isPrint=True)

命令工具通常需要输出执行结果,而数据一般以表格的方式输出更符合查看需求,该方法用于生成并打印表格 Usages: >>> from sunday.core.printTable import printTable >>> printTable(['姓名', '年龄', '性别'])([['张三', 18, '男'], ['翠花', 20, '女']]) +------+------+------+ | 姓名 | 年龄 | 性别 | +------+------+------+ | 张三 | 18 | 男 | | 翠花 | 20 | 女 | +------+------+------+ Args: titleArr(list): 表格头数组 align(str): 数据对齐方式, l(左对齐)、r(右对齐)、c(局中) isPrint(bool): 是否在命令行中打印表格