|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# coding=utf-8 |
| 3 | +import tableformatter as tf |
| 4 | +from tableformatter import generate_table |
| 5 | + |
| 6 | +rows = [('A1', 'A2', 'A3', 'A4'), |
| 7 | + ('B1', 'B2\nB2\nB2', 'B3', 'B4'), |
| 8 | + ('C1', 'C2', 'C3', 'C4'), |
| 9 | + ('D1', 'D2', 'D3', 'D4')] |
| 10 | + |
| 11 | +columns = ('Col1', 'Col2', 'Col3', 'Col4') |
| 12 | + |
| 13 | +tf.TableColors.set_color_library('None') |
| 14 | +with open('table_none.txt', mode='w') as outfile: |
| 15 | + print(generate_table(rows, columns, grid_style=tf.FancyGrid()), file=outfile) |
| 16 | + |
| 17 | +tf.TableColors.set_color_library('colorama') |
| 18 | +with open('table_colorama.txt', mode='w') as outfile: |
| 19 | + print(generate_table(rows, columns, grid_style=tf.FancyGrid()), file=outfile) |
| 20 | + |
| 21 | +tf.TableColors.set_color_library('colored') |
| 22 | +with open('table_colored.txt', mode='w') as outfile: |
| 23 | + print(generate_table(rows, columns, grid_style=tf.FancyGrid()), file=outfile) |
0 commit comments