From 830bca82c49e59af798094aa2c585b2be52b8be1 Mon Sep 17 00:00:00 2001 From: Mike Bloy Date: Sat, 28 Oct 2023 16:23:42 -0500 Subject: [PATCH] ex 3.2 a --- tableformat.py | 5 +++++ tox.ini | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tableformat.py create mode 100644 tox.ini diff --git a/tableformat.py b/tableformat.py new file mode 100644 index 0000000..6903b9e --- /dev/null +++ b/tableformat.py @@ -0,0 +1,5 @@ +def print_table(objects, attributes): + print(*("{: >10}".format(attr) for attr in attributes)) + print(*("{:->10}".format("") for _ in attributes)) + for obj in objects: + print(*("{: >10}".format(getattr(obj, attr, "")) for attr in attributes)) diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..56c1a76 --- /dev/null +++ b/tox.ini @@ -0,0 +1,21 @@ +[pycodestyle] +max-line-length = 87 + +[pydocstyle] +ignore = D203,D213,D400,D401,D407,D413 + +[flake8] +ignore = D401 +enable-extensions = G,M +max_line_length = 87 +exclude = + build/ + dist/ + docs/ + tests/ + .tox/ + _version.py + .* + +[isort] +line_length = 87