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

yipeiwu_com6年前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

相关文章

python xlsxwriter创建excel图表的方法

python xlsxwriter创建excel图表的方法

本文实例为大家分享了python xlsxwriter创建excel图表的具体代码,供大家参考,具体内容如 #coding=utf-8 import xlsxwriter fro...

Python查找第n个子串的技巧分享

Problem Python中str类自带的find、index方法可以返回第一个匹配的子串的位置,但是如果实际使用中需要查找第2个甚至第n个子串的位置该怎么办呢。也许有的码友可能会用到...

python使用Qt界面以及逻辑实现方法

python使用Qt界面以及逻辑实现方法

用过Qt的朋友 特别是QtCreator的习惯在界面UI上面对应的CPP中写代码。但是在PyQt中不是这样的。pyQt只是个界面,只会生成界面即UI,就算是一个按钮也需要在python只...

利用python获取某年中每个月的第一天和最后一天

搜索关键字: python get every first day of month 参考解答: 方法一: >>> import calendar >>...

详解python的四种内置数据结构

对于每种编程语言一般都会规定一些容器来保存某些数据,就像java的集合和数组一样python也同样有这样的结构 而对于python他有四个这样的内置容器来存储数据,他们都是python语...