Python终端输出美化工具
可以通过以下库来美化 Python 终端输出:
- Rich:安装命令 pip install rich
- Colorama:安装命令 pip install colorama
- Prettytable:安装命令 pip install prettytable
下面是使用 Prettytable 库生成的漂亮表格:
+-----------+------+------------+-----------------+
| City name | Area | Population | Annual Rainfall |
+-----------+------+------------+-----------------+
| Adelaide | 1295 | 1158259 | 600.5 |
| Brisbane | 5905 | 1857594 | 1146.4 |
| Darwin | 112 | 120900 | 1714.7 |
| Hobart | 1357 | 205556 | 619.5 |
| Melbourne | 1566 | 3806092 | 646.9 |
| Perth | 5386 | 1554769 | 869.4 |
| Sydney | 2058 | 4336374 | 1214.8 |
+-----------+------+------------+-----------------+
这些工具可以让你的终端输出更加美观,并且可以根据需要更换颜色主题。
以上回复来自 FishC AI 小助理,如未能正确解答您的问题,请继续追问。 |