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的更多相关文章

  1. Python - 3. Input and Output

    from:http://interactivepython.org/courselib/static/pythonds/Introduction/InputandOutput.html Input a ...

  2. [译]The Python Tutorial#7. Input and Output

    [译]The Python Tutorial#Input and Output Python中有多种展示程序输出的方式:数据可以以人类可读的方式打印出来,也可以输出到文件中以后使用.本章节将会详细讨论 ...

  3. Python Tutorial 学习(七)--Input and Output

    7. Input and Output Python里面有多种方式展示程序的输出.或是用便于人阅读的方式打印出来,或是存储到文件中以便将来使用.... 本章将对这些方法予以讨论. 两种将其他类型的值转 ...

  4. 7. Input and Output

    7. Input and Output There are several ways to present the output of a program; data can be printed i ...

  5. [20171128]rman Input or output Memory Buffers.txt

    [20171128]rman Input or output Memory Buffers.txt --//做一个简单测试rman 的Input or output Memory Buffers. 1 ...

  6. Java中的IO流,Input和Output的用法,字节流和字符流的区别

    Java中的IO流:就是内存与设备之间的输入和输出操作就成为IO操作,也就是IO流.内存中的数据持久化到设备上-------->输出(Output).把 硬盘上的数据读取到内存中,这种操作 成为 ...

  7. 标准库 - 输入输出处理(input and output facilities) lua

    标准库 - 输入输出处理(input and output facilities)责任编辑:cynthia作者:来自ITPUB论坛 2008-02-18 文本Tag: Lua [IT168 技术文档] ...

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

  9. 给定一个字符串,把字符串内的字母转换成该字母的下一个字母,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, 字符串内的其他字 ...

随机推荐

  1. rdesktop使用记录

    常用命令 连接远程windows RDP服务器,映射本机/home/ssooking/share/目录到windows上,名称为Myshare. rdesktop -a 16 -u xxx -p xx ...

  2. 学习笔记:The Log(我所读过的最好的一篇分布式技术文章)

    前言 这是一篇学习笔记. 学习的材料来自Jay Kreps的一篇讲Log的博文. 原文非常长.可是我坚持看完了,收获颇多,也深深为Jay哥的技术能力.架构能力和对于分布式系统的理解之深刻所折服.同一时 ...

  3. mybatis打印完整的sql

    mybatis log plugin

  4. 为什么不应该使用Zookeeper做服务发现?(转载)

    转载自: http://dockone.io/article/78 [编者的话]本文作者通过ZooKeeper与Eureka作为Service发现服务(注:WebServices体系中的UDDI就是个 ...

  5. UITableView 自定义多选

    前言 在上一篇文章中介绍了UITableView的多选操作,有提到将 return UITableViewCellEditingStyleDelete | UITableViewCellEditing ...

  6. abtestingGateway错误集锦

    管理接口访问报错 系统版本 内核版本 Ubuntu 14.04.2 3.13.0-32-generic 我们在这里通过curl来插入命令的时候直接报错: curl命令写入规则 curl 'http:/ ...

  7. python 中 __init__方法

    注意1,__init__并不相当于C#中的构造函数,执行它的时候,实例已构造出来了. class A(object): def __init__(self,name): self.name=name ...

  8. numpy学习之创建数组

    1.使用array函数创建数组 import numpy as np ndarray1 = np.array([1, 2, 3]) array([1, 2, 3]) ndarray2 = np.arr ...

  9. C# 客户端篇之实现Restful Client开发(RestSharp帮助类)

    上篇文章<C# 服务端篇之实现RestFul Service开发(简单实用)>讲解到,如果开发一个简单的Restful风格的Service,也提到了简单创建一个Restful Client ...

  10. Xshell正编辑文件时掉线,需再次正常编辑解决办法

    E325: ATTENTION Found a swap file by the name ".weather.py.swp" owned by: pi dated: Mon No ...