GithubHelp home page GithubHelp logo

ascii-table-formatter's Introduction

CS302 ASCII TABLE FORMATTER

This formatter allows you to automatically format an ASCII table for use on homeworks in CS202 so you don't have to spend a bunch of time working on the ASCII art to make your truth tables look nice.

Here is an example output table:

.----+----+-----------+-------.
| A  | B  |Description|Output |
|----+----+-----------+-------|
| 0  | 0  |   zebra   |  1    |
|----+----+-----------+-------|
| 0  | 0  |    bear   |  0    |
|----+----+-----------+-------|
| 0  | 1  |  unicorn  |  1    |
|----+----+-----------+-------|
| 0  | 1  |   llama   |  0    |
|----+----+-----------+-------|
| 1  | 0  |   whale   |  1    |
|----+----+-----------+-------|
| 1  | 0  |  ostrich  |  0    |
|----+----+-----------+-------|
| 1  | 1  |   dragon  |  0    |
|----+----+-----------+-------|
| 1  | 1  |   monkey  |  0    |
'----+----+-----------+-------'

Prerequesites

This requires Python 3.8 which can be downloaded here (Python 3.8.x works great)

If you don't want to download a new python, merely change line 63 in this file to not use the walrus operator :=.

Now on to the fun part, how you can use it––

Simply paste your pre-formatted table like the one seen below into the in.txt

NOTE:The table headers are required to be wrapped in []

[A] [B] [Description] [Output]
0 0 zebra 1
0 0 bear 0
0 1 unicorn 1
0 1 llama 0
1 0 whale 1
1 0 ostrich 0
1 1 dragon 0
1 1 monkey 0

Since it uses stdin and stdout from the sys library, you can set the input and output file paths. python3 table.py < in.txt > out.txt

Hopefully this saves you a bit of time.

How can I use this?

Either copy and paste the table.py file into your editor of choice or clone the repo with git. More information on how to use git can be found here.

ascii-table-formatter's People

Contributors

abehoffman avatar

Watchers

 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.