当前位置:主页 > 软件编程 > Python代码 >

Python中输出ASCII大文字、艺术字、字符字小技巧

时间:2021-06-28 08:24:30 | 栏目:Python代码 | 点击:

复制代码 代码如下:

display text in large ASCII art fonts
显示大ASCII艺术字体

这种东西在源码声明或者软件初始化控制台打印时候很有用。
例如下图:

这是查看HTML源码中截图而来,看到这种字体的网站名称,很cool,下面就介绍一下Python中如何输出这种字符字。

复制代码 代码如下:

$ sudo apt-get install figlet
$ figlet orangleliu
                            _      _ _      
  ___  _ __ __ _ _ __   __ _| | ___| (_)_   _
 / _ \| '__/ _` | '_ \ / _` | |/ _ \ | | | | |
| (_) | | | (_| | | | | (_| | |  __/ | | |_| |
 \___/|_|  \__,_|_| |_|\__, |_|\___|_|_|\__,_|

python中也有这个工具的实现
复制代码 代码如下:

$ sudo pip install pyfiglet
$ pyfiglet orangleliu.info
                             _      _ _         _        __      
  ___  _ __ __ _ _ __   __ _| | ___| (_)_   _  (_)_ __  / _| ___ 
 / _ \| '__/ _` | '_ \ / _` | |/ _ \ | | | | | | | '_ \| |_ / _ \
| (_) | | | (_| | | | | (_| | |  __/ | | |_| |_| | | | |  _| (_) |
 \___/|_|  \__,_|_| |_|\__, |_|\___|_|_|\__,_(_)_|_| |_|_|  \___/

参考这个回答
http://stackoverflow.com/questions/9632995/is-there-a-python-library-that-allows-to-easily-print-ascii-art-text

您可能感兴趣的文章:

相关文章