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 实现识别图片上的数字

python 实现识别图片上的数字

Python 3.6 版本 Pytesseract 图像验证码识别 环境: (1) win7 64位 (2) Idea (3) python 3.6 (4) pip install pi...

python3读取图片并灰度化图片的四种方法(OpenCV、PIL.Image、TensorFlow方法)总结

python3读取图片并灰度化图片的四种方法(OpenCV、PIL.Image、TensorFlow方法)总结

在处理图像的时候经常是读取图片以后把图片转换为灰度图。作为一个刚入坑的小白,我在这篇博客记录了四种处理的方法。 首先导入包: import numpy as np import cv...

python实现mysql的单引号字符串过滤方法

本文实例讲述了python实现mysql的单引号字符串过滤方法。分享给大家供大家参考,具体如下: 最主要用这个函数,可以处理MySQLdb.escape_string(content)....

Python计算时间间隔(精确到微妙)的代码实例

Python计算时间间隔(精确到微妙)的代码实例

使用python中的datetime import datetime oldtime=datetime.datetime.now() print oldtime; x=1 while...

使用python制作游戏下载进度条的代码(程序说明见注释)

使用python制作游戏下载进度条的代码(程序说明见注释)

import time # time模块中包含了许多与时间相关的模块,其中通过time()函数可以获取当前的时间。 count = 100 print("开始下载".center(...