Coder Social home page Coder Social logo

asciicells's Introduction

ASCII Cells - Another ASCII Table Generator

Targeted at Python3

This tool is based on latest Python3 (v3.5.0). It does support Python2.7, but this is an accident.

Install

$ sudo pip install asciicells

or

$ sudo python setup.py install

High level usages

After installed, an executable asciicells would available for use. If not, please replace following examples with python -m asciicells.

$ asciicells -f demo.csv

+-----+---------+-----------+
| No. | sample  | name      |
|     |         |           |
| 1   | a,b,c   | lettes    |
|     |         |           |
| 2   | + - x / | operators |
+-----+---------+-----------+

With header:

$ asciicells -f demo.csv -H

+-----+---------+-----------+
| No. | sample  | name      |
+-----+---------+-----------+
| 1   | a,b,c   | lettes    |
|     |         |           |
| 2   | + - x / | operators |
+-----+---------+-----------+

Also support TSV: asciicells -f demo.tsv -t -H

Low level usages

>>> import asciicells
>>> ac = asciicells.AsciiCells()
>>> L = [['a', 'b'], ['1', '2']]
>>> print(ac.render(L))
+---+---+
| a | b |
|   |   |
| 1 | 2 |
+---+---+

See test.py for more examples.

Why another ASCII table generator?

When needing an ASCII table generator, I googled some but they neither can wrap long lines in single table cell, nor support quoted COMMAs in csv file. So I have to write my own version.

+--------------+----------------------------------------------+--------+
| it must be   | In 2011, millions of people began to use the | Extra  |
| indeed-cont- | China Railways website on a daily basis and  |        |
| inuously     | the system began experiencing problems with  |        |
| available    | performance.                                 |        |
|              |                                              |        |
| his team     | the old system: the relational database was  | Python |
| performed a  | overloaded and could not handle either the   |        |
| root cause   | scale of incoming requests or the level of   |        |
|              | reliability.                                 |        |
+--------------+----------------------------------------------+--------+

Tests and Pull Request

This tool works as long as it generate neat tables. So yes, we have tests by eyes: just run python test.py and check its outputs.

Following KISS, I consider this tool as feature completed. So only accept PRs with bug fixes or code improvements.

Author

mitnk ([email protected])

License

MIT License

asciicells's People

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.