Python - 通过Python显示图形化文本

通过Python显示图形化文本

pyfiglet库(提供各种字体)

rich库(为字符串上颜色)

安装pyfiglet和rich库

pip install pyfiglet
pip install rich

实例

[vip@test03 ~]$ cat test-print.py 
from pyfiglet import Figlet
import rich

f = Figlet(font="slant")
text = f.renderText("VIP")

rich.print(f"[green]{text}[/green]")

[vip@test03 ~]$ 
[vip@test03 ~]$ python test-print.py 
 _    __________ 
| |  / /  _/ __ \ 
| | / // // /_/ / 
| |/ // // ____/ 
|___/___/_/ 
            

[vip@test03 ~]$ 
[vip@test03 ~]$ python --version
Python 3.8.10
[vip@test03 ~]$ 
posted @ 2024-07-23 15:38  Anliven  阅读(5)  评论(0编辑  收藏  举报