This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Plaintable is a very simple library to build plain text tables. It has been created to provide a very lightweight and clear interface for generating plain text tables. Some data can be customized e.g. alignment, padding and floatprecision. Every data item is to be converted to string automatically.

Usage

>>> from plaintable import Table
>>> data = [
...     [1, 2, 3, 4, 5],
...     [10, 11, 12, 13, 14],
...     ['a', 'b', 'c', 'd', 'e'],
...     [1.0, 2.0, 1.5, 4.25, 10.50],
... ]
>>> headline = ['one', 'two', 'three', 'four', 'five']
>>> table = Table(data, headline)
>>> print(table)
one   two   three  four  five
----  ----  -----  ----  -----
1     2     3      4     5
10    11    12     13    14
a     b     c      d     e
1.00  2.00  1.50   4.25  10.50

Customise

The table layout can be customised by passing several keyword arguments to Table.__init__().

headline

A list of strings which will appear as column headers. This argument is optional.

Default: None

align

You can specifiy the alignment of the table (‘l’, ‘r’, ‘c’).

Default: ‘l’

padding

If you need a wider table you can increase the padding.

Default: 2

floatprec

Every float value is converted to str with this precision.

Default: 2

header_padding

Adds extra spaces around header fields.

Default: 0

datetimefs

Specifies the datetime formatstring. Any datetime object is converted to a string refering to this formatstring; see also here.

Default: %Y-%m-%d %H:%M

Further Examples

>>> from plaintable import Table
>>> data = [
...    [1, 2, 3, 4, 5],
...    [10, 11, 12, 13, 14],
...    ['a', 'b', 'c', 'd', 'e'],
...    [1.0, 2.0, 1.5, 4.25, 10.50],
... ]
>>> headline = ['one', 'two', 'three', 'four', 'five']
>>> table = Table(data, headline, align='r', padding=4, floatprec=4)
>>> print(table)
       one       two     three      four       five
    ------    ------    ------    ------    -------
         1         2         3         4          5
        10        11        12        13         14
         a         b         c         d          e
    1.0000    2.0000    1.5000    4.2500    10.5000
>>> from plaintable import Table
>>> data = [
...    [1, 2, 3, 4, 5],
...    [10, 11, 12, 13, 14],
...    ['a', 'b', 'c', 'd', 'e'],
...    [1.0, 2.0, 1.5, 4.25, 10.50],
... ]
>>> table = Table(data)
>>> print(table)
1     2     3     4     5
10    11    12    13    14
a     b     c     d     e
1.00  2.00  1.50  4.25  10.50
>>> from plaintable import Table
>>> data = [
...    [1, 2, 3, 4, 5],
...    [10, 11, 12, 13, 14],
...    ['a', 'b', 'c', 'd', 'e'],
...    [1.0, 2.0, 1.5, 4.25, 10.50],
... ]
>>> table = Table(data, padding=4)
>>> print(table)
1       2       3       4
10      11      12      13
a       b       c       d
1.00    2.00    1.50    4.25
>>> from plaintable import Table
>>> data = [
...    [1, 2, 3, 4, 5],
...    [10, 11, 12, 13, 14],
...    ['a', 'b', 'c', 'd', 'e'],
...    [1.0, 2.0, 1.5, 4.25, 10.50],
... ]
>>> table = Table(data, header_padding=4)
>>> print(table)
one          two          three          four
-----------  -----------  -------------  ------------
1            2            3              4
10           11           12             13
a            b            c              d
1.00         2.00         1.50           4.25
Release History

Release History

0.1.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
plaintable-0.1.1.tar.gz (4.8 kB) Copy SHA256 Checksum SHA256 Source Oct 11, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting