Skip to content

rackodo/bashtable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bashtable




Bashtable is a tables package for Python that provides a simple and easy to use system for creating simplistic and professional looking tables to use in your Python programs.

Bashtable is inspired by Kyostenas' prettyTables and is intended as a simpler way to display data in the Python console.

Table of Contents

Installation

Using pip

Run python -m pip install bashtable in the context of your choice, and Bashtable will be installed into your Python installation's site-packages.

Using setup.py

Download the latest release's source code and run python setup.py install in the root directory.

Usage

Basic bashtable

Input

from bashtable import bashtable

table = bashtable()
table.setData(0, "Bash", "Elliott", "17")
table.setData(1, "Jane", "Doe", "21")
table.setData(2, "John", "Doe", "21")
table.draw()

Output

╔══════╦═════════╦════╗
║      ║         ║    ║
╠══════╬═════════╬════╣
│ Bash │ Elliott │ 17 │
├──────┼─────────┼────┤
│ Jane │ Doe     │ 21 │
├──────┼─────────┼────┤
│ John │ Doe     │ 21 │
╚──────┴─────────┴────╝

Adding column titles

Input

from bashtable import bashtable

table = bashtable()
table.setColumnTitle(0, "First Name")
table.setColumnTitle(1, "Last Name")
table.setColumnTitle(2, "Age")

table.setData(0, "Bash", "Elliott", "17")
table.setData(1, "Jane", "Doe", "21")
table.setData(2, "John", "Doe", "21")
table.draw()

Output

╔════════════╦═══════════╦═════╗
║ First Name ║ Last Name ║ Age ║
╠════════════╬═══════════╬═════╣
│ Bash       │ Elliott   │ 17  │
├────────────┼───────────┼─────┤
│ Jane       │ Doe       │ 21  │
├────────────┼───────────┼─────┤
│ John       │ Doe       │ 21  │
╚────────────┴───────────┴─────╝

Support and Contributions

If you have any suggestions for Bashtable or want to fork Bashtable to improve upon it or add any features, feel free to do so and even make a pull request! I appreciate each and every contribution made.

If you've found a bug, please make an issue so I can work towards fixing it. I am also reachable by email at [email protected].

Credits

Credit to @Kyostenas and his package prettyTables for the inspiration to create Bashtable.