Skip to content

Python thing to generate tables and write them to disk as text files

Notifications You must be signed in to change notification settings

TehNolz/tablepy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

TablePy

(I couldn't think of a better name)

A module to generate text-based tables and save them to a text file.

Usage

Creation

Create a table object;

example = table()

Columns

Table columns can be set at any time, even if there's already rows present.

Set its columns;

example.setColumns("1", "2", "3", "4")

Rows

Table rows can be added at any time. If a row contains more items than there are columns, the extra items will not show up when saving the table.

Add rows;

example.addRow("a", "b", "c", "d")
example.addRow("green", "blue", "yellow", "red")

Sort

Sort the table by the specified column, either ascending or descending. Default is descending.

example.sort("1")
#or
example.sort("1", ascending=False)

Ascending;

example.sort("1", ascending=True)

Saving

Once you finish adding columns and rows to the table, you can save it to file.

Save table to "example.txt". Will create a file if it doesn't exist, otherwise returns an error.

example.save("example.txt")
#or;
example.save("example.txt", fileMode="x")

Append table to "example.txt";

example.save("example.txt", fileMode="a")

Save table to "example.txt", and overwrite it if it already exists;

example.save("example.txt", fileMode="w")

About

Python thing to generate tables and write them to disk as text files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages