I am trying to create a nice column list in python for use with commandline admin tools which I create.
Basicly, I want a list like:
[['a', 'b', 'c'], ['aaaaaaaaaa', 'b', 'c'], ['a', 'bbbbbbbbbb', 'c']]
To turn into:
a b c
aaaaaaaaaa b c
a bbbbbbbbbb c
Using plain tabs wont do the trick here because I don't know the longest data in each row.
This is the same behavior as 'column -t' in Linux..
$ echo -e "a b c
aaaaaaaaaa b c
a bbbbbbbbbb c"
a b c
aaaaaaaaaa b c
a bbbbbbbbbb c
$ echo -e "a b c
aaaaaaaaaa b c
a bbbbbbbbbb c" | column -t
a b c
aaaaaaaaaa b c
a bbbbbbbbbb c
I have looked around for various python libraries to do this but can't find anything useful.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…