Skip to content

Commit 77d7480

Browse files
authored
Merge pull request #43 from python-tableformatter/write_example_0.1
Write example 0.1
2 parents b5fecbc + 8cac56b commit 77d7480

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

Pipfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,20 @@ url = "https://pypi.org/simple"
44
verify_ssl = true
55

66
[packages]
7+
tableformatter = {editable = true,path = "."}
78
wcwidth = "*"
9+
typing = {version = "*",markers = "python_version < '3.5'"}
810

911
[dev-packages]
1012
tableformatter = {editable = true,path = "."}
13+
colorama = "*"
14+
colored = "*"
1115
flake8 = "*"
1216
invoke = "*"
1317
ipython = "*"
1418
pytest = "*"
1519
pytest-cov = "*"
1620
twine = ">=1.11"
21+
cmd2 = "*"
22+
numpy = "*"
23+
pandas = "*"

examples/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
table_colorama.txt
2+
table_colored.txt
3+
table_none.txt

examples/write_table.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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

Comments
 (0)