
prettytable
PrettyTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables, like this:
+-----------+------+------------+-----------------+
| City name | Area | Population | Annual Rainfall |
+-----------+------+------------+-----------------+
| Adelaide | 1295 | 1158259 | 600.5 |
| Brisbane | 5905 | 1857594 | 1146.4 |
| Darwin | 112 | 120900 | 1714.7 |
| Hobart | 1357 | 205556 | 619.5 |
| Melbourne | 1566 | 3806092 | 646.9 |
| Perth | 5386 | 1554769 | 869.4 |
| Sydney | 2058 | 4336374 | 1214.8 |
+-----------+------+------------+-----------------+
PrettyTable lets you control many aspects of the table, like the width of the column padding, the alignment of text within columns, which characters are used to draw the table border, whether you even want a border, and much more. You can control which subsets of the columns and rows are printed, and you can sort the rows by the value of a particular column.
PrettyTable can also generate HTML code with the data in a <table>
structure. All of the options available for controlling ASCII tables are also available for HTML tables, except in cases where this would not make sense.
The "featured Wiki articles" in the green box to your right should contain enough information to get you started.
If you find PrettyTable useful, and especially if you use PrettyTable as part of your business or to otherwise make money, please consider making a completely voluntary donation to show your appreciation and encourage future work on the project, using the PayPal button below:
https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=CN9NGTU6JMXTG&lc=AU&item_name=PrettyTable¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted'>https://www.paypalobjects.com/en_AU/i/btn/btn_donateCC_LG.gif' alt='PayPal — The safer, easier way to pay online.' />
Project Information
- License: New BSD License
- 107 stars
- svn-based source control
Labels:
python
commandline
tables