Giter VIP home page Giter VIP logo

drawtable's Introduction

Drawtable (csvless)

Build Status Coverage Status

Drawtable is a python library for drawing ASCII table with text data. It also contains a command line tool called csvless that helps you view csv files without hassle.

Installation

pip install drawtable

Usage

CLI tool

For details please see csvless -h, here are some typical examples:

$ csvless samples/foo.csv

$ csvless -s markdown samples/foo.csv

$ csvless -s markdown --cat samples/foo.csv

$ csvless -s box -N samples/foo.csv

$ csvless -s box -N -n samples/foo.csv

$ csvless -H samples/foo.csv

$ csvless -w 10 --no-wrap samples/foo.csv

Library

Draw table box for list data:

>>> from drawtable import Table
>>> tb = Table(
...     margin_x=1,
...     margin_y=0,
...     align='left',
...     max_col_width=40,
... )
>>> tb.draw([
...     ['project', 'url'],
...     ['drawtable', 'https://github.com/reorx/drawtable'],
>>> ])
┌───────────┬────────────────────────────────────┐
│ projecturl                                │
├───────────┼────────────────────────────────────┤
│ drawtablehttps://github.com/reorx/drawtable │
└───────────┴────────────────────────────────────┘

Draw a simple one cell box:

>>> from drawtable import Table
>>> tb = Table(
...     margin_x=1,
...     margin_y=0,
...     align='center',
...     max_col_width=40,
... )
>>> tb.draw([[
...     """Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."""
... ]])
┌──────────────────────────────────────────┐
│ Lorem ipsum dolor sit amet, consectetur  │
│ adipiscing elit, sed do eiusmod tempor i │
│ ncididunt ut labore et dolore magna aliq │
│ ua. Ut enim ad minim veniam, quis nostru │
│ d exercitation ullamco laboris nisi ut a │
│     liquip ex ea commodo consequat.      │
└──────────────────────────────────────────┘

drawtable's People

Contributors

reorx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

weaming gridl

drawtable's Issues

Why "cannot import name 'Table' from 'drawbox'"?

My error code:
>>> from drawbox import Table Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'Table' from 'drawbox' (D:\Program Files (x86)\Python\Python37-32\lib\site-packages\drawbox\__init__.py)

My python environment:

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32

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.