推出自己的格式化功能并不难:
def print_table(table): col_width = [max(len(x) for x in col) for col in zip(*table)] for line in table: print "| " + " | ".join("{:{}}".format(x, col_width[i]) for i, x in enumerate(line)) + " |"table = [(str(x), str(f(x))) for x in mylist]print_table(table)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)