|
1 | 1 | # table2ascii |
2 | 2 |
|
3 | 3 | Module for converting 2D Python lists to a fancy ASCII/Unicode tables |
| 4 | + |
| 5 | +- [table2ascii](#table2ascii) |
| 6 | + - [🧑💻 Usage](#-usage) |
| 7 | + - [⚙️ Options](#️-options) |
| 8 | + - [🧰 Development](#-development) |
| 9 | + |
| 10 | +<!-- |
| 11 | +## 📥 Installation |
| 12 | +
|
| 13 | +``pip install table2ascii`` |
| 14 | +--> |
| 15 | + |
| 16 | +## 🧑💻 Usage |
| 17 | + |
| 18 | +Convert Python lists to ASCII tables |
| 19 | + |
| 20 | +```py |
| 21 | +from table2ascii import table2ascii |
| 22 | + |
| 23 | +output = table2ascii( |
| 24 | + header_row=["#", "G", "H", "R", "S"], |
| 25 | + body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]], |
| 26 | + footer_row=["SUM", "130", "140", "135", "130"], |
| 27 | +) |
| 28 | + |
| 29 | +print(output) |
| 30 | + |
| 31 | +""" |
| 32 | +╔═════╦═══════════════════════╗ |
| 33 | +║ # ║ G H R S ║ |
| 34 | +╟─────╫───────────────────────╢ |
| 35 | +║ 1 ║ 30 40 35 30 ║ |
| 36 | +║ 2 ║ 30 40 35 30 ║ |
| 37 | +╟─────╫───────────────────────╢ |
| 38 | +║ SUM ║ 130 140 135 130 ║ |
| 39 | +╚═════╩═══════════════════════╝ |
| 40 | +""" |
| 41 | +``` |
| 42 | + |
| 43 | +```py |
| 44 | +from table2ascii import table2ascii |
| 45 | + |
| 46 | +output = table2ascii( |
| 47 | + body=[["1", "30", "40", "35", "30"], ["2", "30", "40", "35", "30"]] |
| 48 | +) |
| 49 | + |
| 50 | +print(output) |
| 51 | + |
| 52 | +""" |
| 53 | +╔═════╦═══════════════════════╗ |
| 54 | +║ 1 ║ 30 40 35 30 ║ |
| 55 | +║ 2 ║ 30 40 35 30 ║ |
| 56 | +╚═════╩═══════════════════════╝ |
| 57 | +""" |
| 58 | +``` |
| 59 | + |
| 60 | +## ⚙️ Options |
| 61 | + |
| 62 | +Soon table2ascii will support more options for customization. |
| 63 | + |
| 64 | + |
| 65 | +## 🧰 Development |
| 66 | + |
| 67 | +To run tests (pytest) |
| 68 | + |
| 69 | +``python setup.py test`` |
| 70 | + |
| 71 | +To lint (flake8): |
| 72 | + |
| 73 | +``python setup.py lint`` |
0 commit comments