anfederico / tableize

Turn lists into tables with ease

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

                PyPI version Build Status Dependencies GitHub Issues Contributions welcome License

Install

pip install tableize

Code Examples

Create a table with 5 columns

from tableize import tableize

letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o']

t = tableize(letters, cols = 5)
t.show()
a b c d e 
f g h i j 
k l m n o 

Flip how the table is filled

t.flip()
t.show()
a d g j m 
b e h k n 
c f i l o 

Create a table with 10 rows

from tableize import tableize

t = tableize(letters, rows = 10)
t.show()
a k 
b l 
c m 
d n 
e o 
f 
g 
h 
i 
j 

Switch from rows to columns

t.switch()
t.show()
a b c d e f g h i j 
k l m n o

More customization

from tableize import tableize

words = ['apple','bus','cart','drum','empty','flint','get','happy','ill','joker','kneel','lard','no','mop']                   

t = tableize(words, cols = 5)
t.text(bullet = '+ ', spaces = 2, spacer = ' ')
- apple  - bus   - cart   - drum  - empty  
- flint  - get   - happy  - ill   - joker  
- kneel  - lard  - no     - mop  
t.text(bullet = '', spaces = 5, spacer = '~')
apple~~~~~bus~~~~~~cart~~~~~~drum~~~~~empty~~~~~
flint~~~~~get~~~~~~happy~~~~~ill~~~~~~joker~~~~~
kneel~~~~~lard~~~~~no~~~~~~~~mop~~~~~~open~~~~~~
t.write(filename = 'mytable', bullet = '+ ', spaces = 3, spacer = ' ')
mytable.txt

+ apple   + bus    + cart    + drum   + empty   
+ flint   + get    + happy   + ill    + joker   
+ kneel   + lard   + no      + mop  

About

Turn lists into tables with ease

License:MIT License


Languages

Language:Python 100.0%