tablepy usage

the python tablepy package can be used to easily create and render tables. As of right now it only supports rendering lists of lists in tabular form.


it defines the following:

Note

for demonstrational perpaces I will use the input list:

m =[["", "hello", "good by"],
    ["fr", "salut", "aurevoir", "bon jour"],
    ["de", "hallo"]]
tablepy.printTable(table, renderInner=Fasle, filler='')

render a 2d matrix in tabular form. any missing elements will be replaced with the parameter filler. the renderInner parameter will render all the lines inside the table if True. tablepy.printTable(m) will output:

      +-------------------------------------+
      |          hello    good by           |
      | fr       salut    aurevoir bon jour |
      | de       hallo                      |
      +-------------------------------------+
and with renderInner True
     +----------+----------+----------+----------+
     |          | hello    | good by  |          |
     +----------+----------+----------+----------+
     | fr       | salut    | aurevoir | bon jour |
     +----------+----------+----------+----------+
     | de       | hallo    |          |          |
     +----------+----------+----------+----------+
tablepy.clearSlait()

remove all cash data created by htmlTable.

Warning

this function will affects every interpreter instance ans should be used sparingly. it basicly deletes everything. to only destroy this interpreters cash use tablepy.destroyAll()

tablepy.destroyAll()

remove all cash data created by htmlTable in this instance of the interpreter. to remove all cash data use tablepy.clearSlait().


class htmlTable(inp, ...)
the htmlTable class can be used to create html documents containing tables and open them in a browser.
Parameters
  • inp (list[list[object]]) – the input table from witch to generate the table from. The genration works identicly to the one used by tables.printTable().

  • name (str) – the title of the table it doesn’t have any further meaning, default is table

  • keyRowIdx (int) – what row to write in bold letters, if -1 or not a valid value it will not show anything in bowld, default is -1.

  • keyColIdx (int) – same as keyRowIdx but for the collums

  • border (int) – how thick the border of the table should be.

  • encoding (str) – what the encoding system should be defaults to utf-8

  • caption (str) – the catpion of the table, defaults to ""

cash()

resaves the table to the libraries html cash witch can be cleared using tablepy.clearSlait() or tablepy.destroyAll()

open():

open the generated html file using webbrowsers open function.

open_new():

open the generated html file using webbrowsers open_new function.

open_new_tab():

open the generated html file using webbrowsers open_new_tab function.

delete():

delets all cashed data generated by this html table.

copyFile(path):

copies the cashed html file to path :param str path: a valid os path to copy the html file to

Welcome to tablepy’s documentation!