Python script to tabulate data formats like json, csv, html, etc

Related tags

Command-line ToolspyT
Overview

pyT

PyT is a a command line tool and as well a library for visualising various data formats like:

  • JSON
  • HTML Table
  • CSV
  • XML, etc.

Features

  • Print table of any size without distortions.
  • Support multiple file formats.
  • Better presentation of various data structures, types.

Usage

JSON data

{
  "squadName": "Super hero squad",
  "homeTown": "Metro City",
  "formed": 2016,
  "secretBase": "Super tower",
  "active": true,
  "members": [
    {
      "name": "Molecule Man",
      "age": 29,
      "secretIdentity": "Dan Jukes",
      "powers": "Turning tiny"
    },
    {
      "name": "Madame Uppercut",
      "age": 39,
      "secretIdentity": "Jane Wilson",
      "powers": "Million punch"
    },
    {
      "name": "Eternal Flame",
      "age": 1000000,
      "secretIdentity": "Unknown",
      "powers": "Immortality"
    }
  ]
}
import pyT.Table as table
table = Table(*item["members"])
json_table.draw()

JSON file

import pyT.Table as table
json = table.JSON('./tab.json', "members")
json_table = Table(*json)
json_table.draw()

Output

+----------------+----------------+----------------+----------------+
|      name      |      age       | secretIdentity |     powers     |
+----------------+----------------+----------------+----------------+
|  Molecule Man  |       29       |   Dan Jukes    |  Turning tiny  |
+----------------+----------------+----------------+----------------+
|Madame Uppercut |       39       |  Jane Wilson   | Million punch  |
+----------------+----------------+----------------+----------------+
| Eternal Flame  |    1000000     |    Unknown     |  Immortality   |
+----------------+----------------+----------------+----------------+

HTML

Name and surname Profession Salary Mobolaji Abdsalam Elect Technician 55,000 Ibraheem Abdsalam Software Engineer 700,000 IBM Abdsalam Elect Engineer 500, 000 Mobolaji Abdsalam Elect. Technician 55, 000 Ibraheem Abdsalam Software Engineer 700, 000 IBM Abdsalam Elect Engineer 500, 000 ">
 <!doctype html>
    <head>
    </head>
    <body>
        <table border = "1" cellpadding = "5" cellspacing = "5">
             <tr>
                <th>Name and surname</th>
                <th>Profession</th>
                <th>Salary</th>
             </tr>
             <tr>
                <td>Mobolaji Abdsalam</td>
                <td>Elect Technician</td>
                <td>55,000</td>
             </tr>
             <tr>
                <td>Ibraheem Abdsalam</td>
                <td>Software Engineer</td>
                <td>700,000</td>
             </tr>
             <tr>
                <td>IBM Abdsalam</td>
                <td>Elect Engineer</td>
                <td>500, 000</td>
             </tr>
             <tr>
                <td>Mobolaji Abdsalam</td>
                <td>Elect. Technician</td>
                <td>55, 000</td>
             </tr>
             <tr>
                <td>Ibraheem Abdsalam</td>
                <td>Software Engineer</td>
                <td>700, 000</td>
             </tr>
             <tr>
                <td>IBM Abdsalam</td>
                <td>Elect Engineer</td>
                <td>500, 000</td>
             </tr>
        </table>
    </body>
</html>

HTML file

import pyT.Table as table
html = table.HTML('./tab.html', n=0)# n specifies which table to be parsed and rendered.
n = 0 => First table on the page.
n = 1 => Second table on the page.
html_table = Table(*html)
html_table.draw()

Output

+------------------+------------------+------------------+
| Name and surname |    Profession    |      Salary      |
+------------------+------------------+------------------+
|Mobolaji Abdsalam | Elect Technician |      55,000      |
+------------------+------------------+------------------+
|Ibraheem Abdsalam |Software Engineer |     700,000      |
+------------------+------------------+------------------+
|   IBM Abdsalam   |  Elect Engineer  |     500, 000     |
+------------------+------------------+------------------+
|Mobolaji Abdsalam |Elect. Technician |     55, 000      |
+------------------+------------------+------------------+
|Ibraheem Abdsalam |Software Engineer |     700, 000     |
+------------------+------------------+------------------+
|   IBM Abdsalam   |  Elect Engineer  |     500, 000     |
+------------------+------------------+------------------+
Owner
Mobolaji Abdulsalam
Mobolaji Abdulsalam
A web shell client written in python.

Webshell client A webshell client written in python. Only works well for linux for the time being. Why? Because there are too many heavy webshells. So

tchar 1 Dec 07, 2021
Centauro - a command line tool with some network management functionality

Centauro Ferramenta de rede O Centauro é uma ferramenta de linha de comando com

1 Jan 01, 2022
Password manager for the CLI simps.

CLI Password Manager Password manager for the CLI simps. Free software: MIT license

1 Dec 30, 2021
Linux commands Interpreter for Windows and Mac based systems using Python

DBHTermEcIbP Linux commands Interpreter for Windows and Mac based systems using Python Basic Linux commands supported viewing current working director

Vraj Patel 1 Dec 26, 2021
Task-manager-CLI with Priority Modification

Task-manager-CLI with Priority Modification The functions for the app have been written in task.py file. 1. Install Node.js This project requires Node

1 Jan 21, 2022
A simple discord slash command handler for for discord.py.

A simple discord slash command handler for discord.py About ⦿ Installation ⦿ Disclaimer ⦿ Examples ⦿ Documentation ⦿ Discussions Note that master bran

641 Jan 03, 2023
Neovim integration for Google Keep, built using gkeepapi

Gkeep.nvim Neovim integration for Google Keep, built using gkeepapi Requirements Neovim 0.5 Python 3.6+ A patched font (optional. Used for icons) Tabl

Steven Arcangeli 143 Jan 02, 2023
Termtyper is a TUI typing application that provides you a great feel with typing with a lot of options to tweak

Termtyper Termtyper is a TUI (Text User Interface) typing application that provides you a great feel with typing with a lot of options to tweak! It is

Noob Coder 834 Dec 27, 2022
Key-control - A tool for add keys to your Termux app

Key-Control Is a tool for add keys to your Termux app. Cara Penginstalan $ pkg u

Beereva.id 1 Feb 14, 2022
AutoSub is a CLI application to generate subtitle files (.srt, .vtt, and .txt transcript) for any video file using Mozilla DeepSpeech.

AutoSub About Motivation Installation Docker How-to example How it works TO-DO Contributing References About AutoSub is a CLI application to generate

Abhiroop Talasila 414 Jan 06, 2023
Python3 command-line tool for the inference of Boolean rules and pathway analysis on omics data

BONITA-Python3 BONITA was originally written in Python 2 and tested with Python 2-compatible packages. This version of the packages ports BONITA to Py

1 Dec 22, 2021
A simple and easy-to-use CLI parse tool.

A simple and easy-to-use CLI parse tool.

AbsentM 1 Mar 04, 2022
commandline version of wordle game and my auto solver.

Wordle Machine (and Wordle Game) (in commandline) My implementation of the Wordle game (inspired by https://www.powerlanguage.co.uk/wordle/) and my in

Kevin Xu 11 Jan 03, 2023
A cli tool , which shows you all the next possible words you can guess from in the game of Wordle.

wordle-helper A cli tool , which shows you all the next possible words you can guess from the Game Wordle. This repo has the code discussed in the You

1 Jan 17, 2022
🕰 The command line tool for scheduling Python scripts

hickory is a simple command line tool for scheduling Python scripts.

Max Humber 146 Dec 07, 2022
Gitfetch is a simple tool to get github user details

Gitfetch Just a (cli?) tool to get github user details 🙂 Installation 📂 Install Gitfetch via pypi pip install gitfetch or pip install git+https://g

I'm Not A Bot #Left_TG 7 Jan 23, 2022
A Python package for Misty II development

Misty2py Misty2py is a Python 3 package for Misty II development using Misty's REST API. Read the full documentation here! Installation Poetry To inst

Chris Scarred 1 Mar 07, 2022
Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process of them.

Task Manager Automation Tool (TMAT) CLI Command Line (CLI) Application to automate creation of tasks in Redmine, issues on Github and the sync process

Tiamat 5 Apr 12, 2022
A Python command-line utility for validating that the outputs of a given Declarative Form Azure Portal UI JSON template map to the input parameters of a given ARM Deployment Template JSON template

A Python command-line utility for validating that the outputs of a given Declarative Form Azure Portal UI JSON template map to the input parameters of a given ARM Deployment Template JSON template

Glenn Musa 1 Feb 03, 2022
tiptop is a command-line system monitoring tool in the spirit of top.

Command-line system monitoring. tiptop is a command-line system monitoring tool in the spirit of top. It displays various interesting system stats, gr

Nico Schlömer 1.3k Jan 08, 2023