def print_table_fancy_grid(converter, to_file): FileUtils.ensure_file_exists_and_writable(to_file) converted_data = converter.convert(ExportMode.TEXT) tabulated = tabulate(converted_data, converter.headers, tablefmt="fancy_grid") LOG.info("Writing results to file: %s", to_file) FileUtils.write_to_file(to_file, tabulated)
def print_table_html(converter, to_file): import html FileUtils.ensure_file_exists_and_writable(to_file) converted_data = converter.convert(ExportMode.HTML) tabulated = tabulate(converted_data, converter.headers, tablefmt="html") # Unescape manually here, as tabulate automatically escapes HTML content and there's no way to turn this off. tabulated = html.unescape(tabulated) LOG.info("Writing results to file: " + to_file) FileUtils.write_to_file(to_file, tabulated)