Package: tabulux
tabuluxThis package is for performing tablular operations and for making making tabular data.Download this documetationThis module requires 'pyperclip', for using the copy-paste feature
You can still use this module without pyperclip, but it is strongly recommended to install pyperclipvisit PyPI-PyperclipImport using:import tabuluxCreate a table object using thetableclasssyntax:table_obj = tabulux.table(   
    {   
    'Head-A':['Content-A1','Content-A2',],   
    'Head-B':['Content-B1','Content-B2',],   
    }   
)Now the table object have been saved to 'table_obj'A Virtul table of the above object can be imagined like this:| Head-A      | Head-B      |
|-------------+-------------|
| Content-A1  | Content-B1  |
| Content-A2  | Content-B2  |Available functions and methods:column_length()- returns the column lengthrow_length()- returns the row lengthheads()- returns the all the headings of the table as a list of stringshead()- returns the heading of the specified column as a stringcell()- returns the content of a specified celldisplay()- prints the data in the table in a tabulated formrow()- returns a specific row from the table as a list of stringcolumn()- returns a specific column from the table as a list of stringchange()- use this to change the content of a cell after the creation of the tableadd()returns the sum of two cell contentadd_all()- returns the sum of a series of cellshtml()- returns the html code of the tablecolumn_length()Use this method when you need the column length of the tableSyntax:table_obj.column_length(copy={True/False})where:table_obj= a table objectcopy= This boolean attribute copies the result as text to your clipboard (False by default)returns integer representing the number of column intable_objrow_length()Use this method when you need the number of rows of the tableSyntax:table_obj.row_length(copy={True/False})where:table_obj= a table objectcopy= This boolean attribute copies the result as text to your clipboard (False by default)returns integer representing the number of rows intable_objcolumn()You could use the column() method to get a list containing all the elements in the specified column as a listSyntax:table_obj.column(column_number)where:table_obj= a table objectcolumn_number= an integer which represents column number (starting from 0) or, the heading of the column (as a string)returns all the elements from the specified column as list of strings. The column headings are not returnedACellOutOfBoundsExceptionis raised if the specified column exceeds the number of columns in the tablerow()You can use the row() method to get all the elements in a specified row in the table as a listSyntax:table_obj.row(row_number)where:table_obj= a table objectrow_number= an integer representing the row number (starts from 0)returns all the elements from the specified row as list of strings.ACellOutOfBoundsExceptionis raised if the specified row exceeds the number of rows in the tableheads()Use heads() when you want all the headings of the tableSyntax :table_obj.heads()where:table_obj= a table objectreturns a list of string representing the each heading of the tablehead()Use head() when you want a heading of a specific column from the tableSyntax:table_obj.head(column_number, copy={True/False})where:table_obj=  A table objectcolumn_number=  An integer representing the column number, whose heading you wantcopy=  A boolean- if True, copies the heading to your clipboard(False by default)returns the heading of the specified column of the table as a string.cell()Syntax:Use this method when you need the cell content of a celltable_obj.cell(row_ID, column_ID, copy={True/False})where,table_obj= table objectrow= integer representing the row number (starting from 0), or, the heading of the column as a stringcolumn= integer representing the column number (starting from 0)copy= a boolean, if true- copies the result to your clipboard(False,by default)returns the Cell Content of the specified location as String.If the cell is not defined in the table or the rows or column given is out of bounds, aCellOutOfBoundsExceptionis raiseddisplay()Use this method when you need to print the table in the consoleSyntax :table_obj.display()where:table_obj= a table objectOutput:
prints data intable_objin a tabular form
Here is how the table would be printed:|Head-A |  Head-B | 
-------------------
|content-A1 | Content-B1 | 
|content-A2 | Content-B2 |This method does not return anythingchange()Use change() method to change the content of a cellSyntax:table_obj.change(row_ID, column_ID, new_content)where,table_obj=  a table objectrow_ID=  an integer representing the column number(starts from 0)column_ID=  an integer representing the column number(starts from 0), or the heading of the column as a stringnew_content=  a string containg the new contentchanges the of the specified column to the content innew_contentyou can also set a cell content to whatever text copied to your clipboard, by setting the 'paste' argument to TrueSyntax:table_obj.change(row_ID, column_ID, new_content, paste=True)the 'new_content' is ignored if paste is set to True, so you can leave the new content as"".
This changes the cell in the specified location to the text in the clipboard.Aditionaly, this method also returns the old content of the specified celladd()The add method can be used to add two cells, if the cells are integers or can be converted to integers,Syntax:table_obj.add(row1, column1, row2, column2, copy={True/False})where:table_obj= a table objectrow1= cell row of the first cell as an integercolumn1= cell column of the first cell as an integer, or the heading of the column as a stringrow2= cell row of the second cell as an integercolumn2= cell column of the second cell as an integer, or the heading of the column as a stringcopy= If this boolean attribute is set to True, the result will be copied to your clipboard(False by default)returns the sum of the two cellsadd_all()The add_all() method can be used to add all the cells from a cell to another cell, if all their values are integersSyntax:table_obj.add_all(from_row, from_column, to_row, to_column, copy={True/False})where:table_obj= a table objectfrom_row= row number of the first cellfrom_column= column number of the first cellto_row= row number of the last cellto_column= column number of the last cellcopy= a boolean, if True- the result will be copied to your clipboard (False by default)returns the sum of all the content of cells between the specified cells.If any cell content cannot be converted to an integer, 'TypeError' is raisedNOTE: The the ending cell address(to_row, to_column) is not included in the sum.html()The 'html()' method is used to get the html snippet of a table.Syntax:table_obj.html(display={True/False}, copy={True/False}, indent={int})where:table_obj= a table objectdisplay= if set to True, this boolean attribute will display the html snippet in the console\terminal, (False by default)copy= this boolean attribute, if set to True, copies the html snippet to you clipboard, and can by pasted to your html file(False by default)indent= indentation spaces that sould be applied, as integer (4 by default)returns the html snippet of the table as a string, from and including <table> to </table>Take me to this project's github repository page