[Python] Print input and output in table
Print the input and output in a table using prettyTable.
from prettytable import PrettyTable
import collections def printTableResult(variables, count):
inputList = collections.defaultdict(list)
outputList = collections.defaultdict(list)
resultTable = PrettyTable() for variable in variables:
if variable.type == "input":
inputList[variable.variable_id] = variable.values
length = len(variable.values)
elif variable.type == "output":
outputList[variable.variable_id] = variable.values logIdColumn = []
outputSepColumn = []
for i in range(count):
logIdColumn.append(i)
outputSepColumn.append("")
resultTable.add_column("Run ID", logIdColumn) for each in inputList:
column = []
for i in range(count):
column.append(inputList[each][i].value)
resultTable.add_column(each,column)
resultTable.add_column("output", outputSepColumn)
for each in outputList:
column = []
for i in range(count):
column.append(outputList[each][i].value)
resultTable.add_column(each, column) print(resultTable)
[Python] Print input and output in table的更多相关文章
- Python - 3. Input and Output
from:http://interactivepython.org/courselib/static/pythonds/Introduction/InputandOutput.html Input a ...
- [译]The Python Tutorial#7. Input and Output
[译]The Python Tutorial#Input and Output Python中有多种展示程序输出的方式:数据可以以人类可读的方式打印出来,也可以输出到文件中以后使用.本章节将会详细讨论 ...
- Python Tutorial 学习(七)--Input and Output
7. Input and Output Python里面有多种方式展示程序的输出.或是用便于人阅读的方式打印出来,或是存储到文件中以便将来使用.... 本章将对这些方法予以讨论. 两种将其他类型的值转 ...
- 7. Input and Output
7. Input and Output There are several ways to present the output of a program; data can be printed i ...
- [20171128]rman Input or output Memory Buffers.txt
[20171128]rman Input or output Memory Buffers.txt --//做一个简单测试rman 的Input or output Memory Buffers. 1 ...
- Java中的IO流,Input和Output的用法,字节流和字符流的区别
Java中的IO流:就是内存与设备之间的输入和输出操作就成为IO操作,也就是IO流.内存中的数据持久化到设备上-------->输出(Output).把 硬盘上的数据读取到内存中,这种操作 成为 ...
- 标准库 - 输入输出处理(input and output facilities) lua
标准库 - 输入输出处理(input and output facilities)责任编辑:cynthia作者:来自ITPUB论坛 2008-02-18 文本Tag: Lua [IT168 技术文档] ...
- C lang:character input and output (I/O)
Xx_Introduction Character input and output is by more line character conpose of the text flow Defin ...
- 给定一个字符串,把字符串内的字母转换成该字母的下一个字母,a换成b,z换成a,Z换成A,如aBf转换成bCg, 字符串内的其他字符不改变,给定函数,编写函数 void Stringchang(const char*input,char*output)其中input是输入字符串,output是输出字符串
import java.util.Scanner; /*** * 1. 给定一个字符串,把字符串内的字母转换成该字母的下一个字母,a换成b,z换成a,Z换成A,如aBf转换成bCg, 字符串内的其他字 ...
随机推荐
- nmon监控
原文:https://www.cnblogs.com/wnfindbug/p/5719181.html 一.检查安装环境 # uname –a (查看操作系统信息,所检查服务器为64位操作系统) Li ...
- delphi怎样把子窗体显示在pagecontrol的tabsheet
https://bbs.csdn.net/topics/391980918 unit Unit1; interface uses Winapi.Windows, Winapi.Messages, Sy ...
- Mysql数据按天分区,定期删除
需求: 1.日志表需要按天分区 2.只保留一个月数据 方案: 1.创建两个事件,一个事件生成未来需要的分区,另一个事件定期检查过期数据(移除分区) 2.创建事件每小时执行一次,删除事件每天执行一次 3 ...
- wamp 3.0.6(apache 2.4.23) 403 forbidden 解决办法
https://www.cnblogs.com/airbreak/p/6369764.html
- replay的意义
数据库重放: () 在测试环境中重新创建实际的生产数据库工作量. () 在生产中实施更改之前,确定和分析潜在的不稳定性. () 捕获生产中的工作量:
- 经验之谈:Swing的开发工作会非常的累,而且这项技术正在走向没落。避免从事有这种特征的工作。
经验之谈:Swing的开发工作会非常的累,而且这项技术正在走向没落.避免从事有这种特征的工作. AWT也即将被取代. Module8—Module11所使用的技术都将被JSF技术所取代. JSF是 ...
- win10 安装node.js node.js 安装成功但npm -v 报错问题解决
错误症状官网下载node-v8 .node-v10 的msi 安装进行安装. npm -v 错误如下 0 info it worked if it ends with ok 1 verbose cli ...
- tensorflow finuetuning 例子
最近研究了下如何使用tensorflow进行finetuning,相比于caffe,tensorflow的finetuning麻烦一些,记录如下: 1.原理 finetuning原理很简单,利用一个在 ...
- JS -- serializeJSON
http://www.cnblogs.com/linzenews/p/7065050.html
- thinkcmf 5关闭后台验证码
控制器修改 D:\cmf\thinkcmf\app\admin\controller\PublicController.php 注释 /* $captcha = $this->request-& ...