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. mac中安装lua5.1.5

    lua有一个工具lua-releng( https://github.com/openresty/openresty-devel-utils/blob/master/lua-releng) 用来检测代 ...

  2. SudaMod-81.0 / crDroidAndroid-8.1(android-8.1.0_r20)红米3 2018年5月3日更新

    一.写在前面 我只是个人爱好,本ROM未集成任何第三方推广软件,我只是喜欢把好的资源分享出来,若可以,我们一起学习,一起进步. 请不要问我怎么刷机! 请不要问我玩游戏卡不卡(有钱你就换好点的手机)! ...

  3. 【转】IT大牛博客

    原文:http://blog.csdn.net/qq1175421841/article/details/49384841 首届中国最受欢迎50大技术博客获奖名单如下: 第一名:李会军  http:/ ...

  4. ubuntu cli

    查看安装包的路径 dpkg -L redis-server 防火墙 ufw redis 相关 service redis-server restart

  5. springboot2.x版本整合redis(单机/集群)(使用lettuce)

    在springboot1.x系列中,其中使用的是jedis,但是到了springboot2.x其中使用的是Lettuce. 此处springboot2.x,所以使用的是Lettuce.关于jedis跟 ...

  6. kafka性能测试

    参考阿里中间件团队博客的博文 Kafka vs RocketMQ——多Topic对性能稳定性的影响 使用的测试工具为Jmeter

  7. KafkaManager对offset的两种管理方式

    OffsetManager主要提供对offset的保存和读取,每个broker都有一个OffsetManager实例,kafka管理topic的偏移量有2种方式: 1.ZookeeperOffsetM ...

  8. k8s(5)-拓展服务

    在之前我们创建了一个部署,然后通过服务公开它.部署只创建了一个Pod来运行我们的应用程序.当流量增加时,我们需要扩展应用程序以满足用户需求. 通过更改部署中的副本数来完成扩展. 1. 拓展部署 这里将 ...

  9. Win10 高分屏软件界面字体模糊问题解决

    只需要将自定义缩放值改为 124% 即可

  10. 使用glusterfs 作为 kubernetes PersistentVolume PersistentVolumeClaim 持久化仓库,高可用Rabbitmq,高可用mysql,高可用redis

    glusterfs 怎么集群,网上一搜铺天盖地的 可利用这个特点做单节点高可用,因为K8S 哪怕节点宕机了 master 会在随意一台节点把挂掉的复活 当然我是在自己的环境下跑,经过网络的gluste ...