def list_plugins(cls): pt = PrintTable(['name', 'version', 'author', 'description']) for plugin_name in cls.plugins.keys(): pt.add_row([ plugin_name, cls.plugin_info[plugin_name]['version'], cls.plugin_info[plugin_name]['author'], cls.plugin_info[plugin_name]['description'], ]) if pt.row_data: print(pt) else: print("No plugins found!")
from printtable import PrintTable table = PrintTable(['name', 'old']) table.append_data(name="Jack", old="20") table.append_data(name=["Jack", "Mary"], old=["20", "19"]) table.append_data_list(["Jack", "20"]) print "The table with line number\n" table.printTable(1) print "The table without line number\n" table.printTable()