Skip to main content

Simple package that generates UTF-8 tables

Project description

utf-table-generator

Модуль генерирует код для печати вот так таких таблиц:

╔════════╦═════════════╦═══════╦═════════╦════╗
║ number ║       float ║     t ║ boolean ║  a ║
╠════════╬═════════════╬═══════╬═════════╬════╣
║    123 ║   12345.456 ║  test ║    True ║  1 ║
╚════════╩═════════════╩═══════╩═════════╩════╝

Вот так использовать:

from utf_table_generator.table import Table

titles = ('number', 'float', 't', 'boolean', 'a')
variables = (123, 12345.4564876435, 'test', True, 1)
t = Table(titles, variables, precision=3)  # precision -- количество знаков после запятой, по умолчанию 5
print(t.get_code())

Пример сгенерированного кода:

print("╔" + "═" * 8 + "╦" + "═" * 13 + "╦" + "═" * 7 + "╦" + "═" * 9 + "╦" + "═" * 4 + "╗")
print("║%7s%12s%6s%8s%3s ║" % ("number", "float", "t", "boolean", "a"))
print("╠" + "═" * 8 + "╬" + "═" * 13 + "╬" + "═" * 7 + "╬" + "═" * 9 + "╬" + "═" * 4 + "╣")
print("║%7d%12.3f%6s%8s%3d ║" % ())
print("╚" + "═" * 8 + "╩" + "═" * 13 + "╩" + "═" * 7 + "╩" + "═" * 9 + "╩" + "═" * 4 + "╝")

Принимаемые значения: int, float, boolean и все объекты с методом __str__

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utf_table_generator-1.0.4.tar.gz (4.0 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page