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
Built Distribution
Close
Hashes for utf_table_generator-1.0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fbff76c4d5de1511b8aa01f8c327e4a93c8469573cee0cd78edf14e90ea15bac |
|
MD5 | 540136ae06490088f20f0a311d2b3215 |
|
BLAKE2b-256 | 035e25ee0261f6a0117b787964fe2facad5dbf1b00ac968ba0e208240ad8cec6 |
Close
Hashes for utf_table_generator-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 064071e1fd1cde3406c7e051e2824d5ec68ccb324ba906f3a211fe58325e2b24 |
|
MD5 | e9a75784e69c21c3865db9bf6cfee57e |
|
BLAKE2b-256 | 8f04db95a40f0b33f6bab576a5ab6f25f7cadcdd56a1a494ebfde3a06ecdc146 |