Home >Backend Development >Python Tutorial >Python中输出ASCII大文字、艺术字、字符字小技巧

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

WBOY
WBOYOriginal
2016-06-06 11:26:122445browse

代码如下:


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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn