Prettier Printing in Python
I’m also printing little reports for myself with python scripts, and often I end up with kind of ugly tables that look like this:
Hello 30 Hello World 40
Today, I finally took the trouble to dig into the python documentation, and it turns out to be quite easy to print prettier tables:
In [11]: for i in [["Hello", 30], ["Hello World", 40]]: print "%s %s" % (str(i[0]).ljust(20), i[1]) ....: Hello 30 Hello World 40
Let's talk
I'm one of the founders of Venmo. If you liked this essay/experiment -- or didn't -- @ me.