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 strip lstrip rstrip使用方法

    注意的是,传入的是一个字符数组,编译器去除两端所有相应的字符,直到没有匹配的字符,比如: theString = 'saaaay&nb...

Python使用multiprocessing创建进程的方法

本文实例讲述了Python使用multiprocessing创建进程的方法。分享给大家供大家参考。具体分析如下: 进程可以通过调用multiprocessing的Process进行创建,...

python3中替换python2中cmp函数的实现

python3中替换python2中cmp函数的实现

python 3.4.3 的版本中已经没有cmp函数,被operator模块代替,在交互模式下使用时,需要导入模块。 在没有导入模块情况下,会出现 提示找不到cmp函数了,那么在p...

Python3实现取图片中特定的像素替换指定的颜色示例

Python3实现取图片中特定的像素替换指定的颜色示例

本文实例讲述了Python3实现取图片中特定的像素替换指定的颜色。分享给大家供大家参考,具体如下: 1、原始图片 2、修改脚本: # -*- coding:utf-8 -*- #!...

Python中的ctime()方法使用教程

 ctime()方法转换,因为历元到表示本地时间的字符串表示以秒为单位的时间。如果不设置秒时或None,所返回的时间的当前time()被使用。使用asctime(localti...