Skip to main content

Print ASCII tables for terminals

Project description

https://badge.fury.io/py/beautifultable.svg https://img.shields.io/pypi/pyversions/beautifultable.svg https://codecov.io/gh/pri22296/beautifultable/branch/master/graphs/badge.svg https://api.codacy.com/project/badge/Grade/7a76eb35ad4e450eaf00339e98381511 https://travis-ci.org/pri22296/beautifultable.svg?branch=master Documentation Status https://img.shields.io/badge/Donate-PayPal-yellow.svg

Introduction

This Package provides BeautifulTable class for easily printing tabular data in a visually appealing ASCII format to a terminal.

Features included but not limited to:

  • Full customization of the look and feel of the table

  • Build the Table as you wish, By adding rows, or by columns or even mixing both these approaches.

  • Full support for colors using ANSI sequences or any library of your choice. It just works.

  • Plenty of predefined styles for multiple use cases and option to create custom ones.

  • Support for Unicode characters.

Usage

Here is an example of how you can use beautifultable:

>>> from beautifultable import BeautifulTable
>>> table = BeautifulTable()
>>> table.column_headers = ["name", "rank", "gender"]
>>> table.append_row(["Jacob", 1, "boy"])
>>> table.append_row(["Isabella", 1, "girl"])
>>> table.append_row(["Ethan", 2, "boy"])
>>> table.append_row(["Sophia", 2, "girl"])
>>> table.append_row(["Michael", 3, "boy"])
>>> print(table)
+----------+------+--------+
|   name   | rank | gender |
+----------+------+--------+
|  Jacob   |  1   |  boy   |
+----------+------+--------+
| Isabella |  1   |  girl  |
+----------+------+--------+
|  Ethan   |  2   |  boy   |
+----------+------+--------+
|  Sophia  |  2   |  girl  |
+----------+------+--------+
| Michael  |  3   |  boy   |
+----------+------+--------+

You can learn more about beautifultable at this Tutorial

Installation

pip install beautifultable

Changelog

v0.7.0

  • Added 4 new styles, STYLE_BOX, STYLE_BOX_DOUBLED, STYLE_BOX_ROUNDED, STYLE_GRID.

  • Renamed STYLE_RESTRUCTURED_TEXT to STYLE_RST

  • wcwidth is now an optional dependency

  • Updated the algorithm for calculating width of columns(better division of space among columns)

  • Added support for Paragraphs(using \n character)

  • Added finer control for intersection characters using 12 new attributes intersect_{top|header|row|bottom}_{left|mid|right}

  • Added the ability to also accept bytestrings instead of unicode

  • Deprecated attribute intersection_char

  • Deprecated methods get_top_border(), get_bottom_border(), get_header_separator(), get_row_separator(), auto_calculate_width()

  • Fixed an issue with WEP_ELLIPSIS and WEP_STRIP when using multibyte characters

  • Fixed an issue where table would not be in proper form if column_width is too low

v0.6.0

  • Added support for handling Multi byte strings

  • Added support for colored strings using ANSI escape sequences

  • Added constraint where all strings must be unicode

  • Fixed an issue where sometimes width was calculated as higher than intended

v0.5.3

  • Added support for handing color codes using ANSI escape sequences(experimental)

  • Fixed collections ABCs deprecation warning

v0.5.2

  • Added new style STYLE_NONE

  • Fixed issue regarding improper conversion of non-string floats

v0.5.1

  • Added detect_numerics boolean for toggling automatic numeric conversion

v0.5.0

  • Added new property serialno_header

  • Deprecated methods with misspelled “seperator” in their name.

  • Fixed an issue where table was corrupted when column_count was too high

v0.4.0

  • Added predefined styles for easier customization

  • Added reverse argument to sort() method

  • Fixed enum34 dependency for python versions prior to 3.4

v0.3.0

  • Added property serialno for auto printing serial number

  • Fixed an issue with sign_mode related to str conversion

  • Fixed bugs related to python version prior to 3.3

  • Fixed exception on WEP_ELLIPSIS and token length less than 3

  • Fixed printing issues with empty table

v0.2.0

  • Added python 2 support

v0.1.3

  • Fixed minor issues

v0.1.2

  • Added new property default_padding

  • Added new method update_row

  • Fixed an issue in auto_calculate_width()

v0.1.1

  • Initial release on PyPI

Contribute

If you have any suggestions or bug reports, Please create a Issue. Pull Requests are always welcome.

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Donation

Love beautifultable? Consider supporting the development :)

https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

beautifultable-0.7.0.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

beautifultable-0.7.0-py2.py3-none-any.whl (22.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file beautifultable-0.7.0.tar.gz.

File metadata

  • Download URL: beautifultable-0.7.0.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for beautifultable-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8deee768c7939578412f930c95c2ac51307fb723a6368e9e233091cdad240537
MD5 4ddf644a6bf625cc77ba8d69fbfba00e
BLAKE2b-256 fa60c7274427e65f2beb3da102bf189effff6a34d5e958fa2c48544d6b384094

See more details on using hashes here.

File details

Details for the file beautifultable-0.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: beautifultable-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for beautifultable-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f1185c5bbb2d522a9c7dfe24cc55151f32379031d001c9731a2b55714b927089
MD5 0d11d944b5f8b6620917ee81a6b44e7f
BLAKE2b-256 400e1ef87ba3851bae0c6e8dea2338f5d8952c87f3b4dcbdaaeedffeb3ab2139

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page