summaryrefslogtreecommitdiff
path: root/README.rst
blob: b190bc0956f88a8a04ad05e3a6f11d4996cfa7d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
============
About PTable
============

PTable is a simple Python library designed to make it quick and easy to
represent tabular data in visually appealing ASCII tables, originally
forked from `PrettyTable <https://code.google.com/p/prettytable/>`_.

.. image:: https://travis-ci.org/kxxoling/PTable.svg
    :target: https://travis-ci.org/kxxoling/PTable
    :alt: Build Status

.. image:: https://landscape.io/github/kxxoling/PTable/master/landscape.svg?style=flat
    :target: https://landscape.io/github/kxxoling/PTable/master
    :alt: Code Health

.. image:: https://coveralls.io/repos/github/kxxoling/PTable/badge.svg?branch=master
    :target: https://coveralls.io/github/kxxoling/PTable?branch=master
    :alt: Coverage


Installation
============

As PTable is a fork of PrettyTable, and compatible with all its APIs,
so PTable is usage is the same as PrettyTable, and the installation
would cover on the original PrettyTable.

As always, you can install PTable in 3 ways.

Via pip (recommend)::

    pip install PTable

Via easy_install::

    easy_install PTable

From source::

    python setup.py install


Quick start
===========

PTable supports two kinds of usage:


As a library
------------

PTable library API is almost as PrettyTable, you can import the same API from
``prettytable`` library:

.. code-block:: python

    from prettytable import PrettyTable
    x = PrettyTable()

A better hosted document is hosted on `ReadTheDocument <http://ptable.readthedocs.org/>`_.


As command-line tool
--------------------

This is an original function of PTable, can be used as ``ptable`` command:

.. code-block:: shell

    ptable --csv somefile.csv

or a Unix style pipe:

.. code-block:: shell

    cat somefile.csv | ptable

Will both print a ASCII table in terminal.



Relative links
==============

* `Source Code (GitHub) <https://github.com/kxxoling/PrettyTable>`__
* `RTFD <https://ptable.readthedocs.org>`__
* `PyPI <https://pypi.python.org/pypi/ptabl://pypi.python.org/pypi/ptable>`__
* `PrettyTable <https://code.google.com/p/prettytable/>`_