本文介绍了Python中的文本到ASCII艺术生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我们开发人员的命令行工具中添加一个复活节彩蛋,如果某个日期匹配,它将向其用户致意。基本上,我正在寻找:

I would like to add an easter egg to one our developers' command line tools, which will greet its user if a certain date is matched. Basically, I'm looking for:

>>> print big_text("Happy\nBirthday")                                                                                   

   .                   _________   _...._    _________   _...._                    
 .'|                   \        |.'      '-. \        |.'      '-. .-.          .- 
<  |                    \        .'```'.    '.\        .'```'.    '.\ \        / / 
 | |             __      \      |       \     \\      |       \     \\ \      / /  
 | | .'''-.   .:--.'.     |     |        |    | |     |        |    | \ \    / /   
 | |/.'''. \ / |   \ |    |      \      /    .  |      \      /    .   \ \  / /    
 |  /    | | `" __ | |    |     |\`'-.-'   .'   |     |\`'-.-'   .'     \ `  /     
 | |     | |  .'.''| |    |     | '-....-'`     |     | '-....-'`        \  /      
 | |     | | / /   | |_  .'     '.             .'     '.                 / /       
 | '.    | '.\ \._,\ '/'-----------'         '-----------'           |`-' /        
 '---'   '---'`--'  `"                    _______                     '..'         
/|        .--.                   .        \  ___ `'.                               
||        |__|                 .'|         ' |--.\  \          .-.          .-     
||        .--..-,.--.      .| <  |         | |    \  '          \ \        / /     
||  __    |  ||  .-. |   .' |_ | |         | |     |  '    __    \ \      / /      
||/'__ '. |  || |  | | .'     || | .'''-.  | |     |  | .:--.'.   \ \    / /       
|:/`  '. '|  || |  | |'--.  .-'| |/.'''. \ | |     ' .'/ |   \ |   \ \  / /        
||     | ||  || |  '-    |  |  |  /    | | | |___.' /' `" __ | |    \ `  /         
||\    / '|__|| |        |  |  | |     | |/_______.'/   .'.''| |     \  /          
|/\'..' /     | |        |  '.'| |     | |\_______|/   / /   | |_    / /           
'  `'-'`      |_|        |   / | '.    | '.            \ \._,\ '/|`-' /            
                         `'-'  '---'   '---'            `--'  `"  '..'             

是否有相应的包装?

推荐答案

您在此处链接的TAAG应用的作者。 TAAG中的大多数字体都是FIGlet字体(figlet.org)。 FIGlet是一个命令行Linux应用程序,但是FIGlet驱动程序已经用几种语言编写。我在这里释放了用JavaScript编写的驱动程序:

Author of the TAAG app you linked here. Most of the fonts in TAAG are FIGlet fonts (figlet.org). FIGlet is a command line linux app, but FIGlet drivers have been written in several languages. I released the driver I wrote in JavaScript here:

尽管这需要移植到Python才能工作。我搜索了FIGlet Python库,发现了以下内容:

Though that would need to be ported to Python to work. I did a search for FIGlet Python libraries and found this:

我不确定它的运行状况或实现的规范数量,但看起来还算完整。

I'm not sure how well it works, or how much of the spec it implements, but it looks pretty complete.

这篇关于Python中的文本到ASCII艺术生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 00:58