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. h5 扫描二维码打开app和点击下载功能的实现

    window.onload = function () { jumpToapp() } var browser = { isAndroid: function () { return navigato ...

  2. HTML Table to Json

    HTML 表格输出JSON <table class="table table-striped table-bordered table-hover dataTable no-foot ...

  3. windows 端口被占用,并杀死进程的方法

    netstat -ano | findstr 8081 查询端口 被什么进程占用 tasklist | findstr 2184 根据进程号 查询任务名称 taskkill /f /t /im jav ...

  4. How do I use IValidatableObject? 使用IValidatableObject添加自定义属性验证

    Here's how to accomplish what I was trying to do. Validatable class: public class ValidateMe : IVali ...

  5. iview表单验证不生效问题注意点

    按照iview官网介绍写的form表单验证,但是无论填写与否都不进行校验,找了很久的原因,突然才发现一个关键的地方,一定要加props!!! https://blog.csdn.net/xuaner8 ...

  6. 3 ansible-playbook 条件语句-外部变量使用

    外部变量指的是从playbook文件之外获取的数值 lookups file file是我们经常使用的一种lookups的方式,它的原理就是使用python的codecs.open打开文件然后把结果返 ...

  7. zoj 3871

    貌似这道题某人已经扔给我一个多星期了(雾) 首先要知道这样一点:凸包的面积可以直接用线段的有向面积和求得. 自己口胡的证明:单纯一条线段自身的叉积就是到原点与这条线段构成三角形的面积吧,那么加加减减之 ...

  8. filter的知识点 和 实例

    一.过滤器Filter 1.filter的简介 filter是对客户端访问资源的过滤,符合条件放行,不符合条件不放行,并且可以对目    标资源访问前后进行逻辑处理 2.快速入门 步骤: 1)编写一个 ...

  9. common lisp里的几个操作符

    setf  赋值操作符,定义一个全局变量.返回值是最后一个赋值的结果. let 局部变量操作符.let表达式有两部分组成.第一部分是任意多的变量赋值,他们被包裹在一个()中,第二部分是任意数量的表示式 ...

  10. OOD之问题空间到解空间—附FP的建模

    通常会被问到,什么事OOD,然后大部分人期待的答案比较死板,继承.封装.多态!懂这个的人多的去了,有什么好问?回答出来的人是否拿着Java又去做一些面向过程的勾当? 计算机革命起源于机器,因此编程语言 ...