0 0
WP Ad Inserter plugin
Read Time:1 Minute, 23 Second

Hey, internet programmers today we write a python program that generates text to ASCII art. Let’s code Text to ASCII art using python.


We use pyfiglet python module to generate Text to ASCII text art in python. pyfiglet takes ASCII text and renders it in ASCII art fonts. figlet_format method converts ASCII text into ASCII art fonts.

Installation

pip install pyfiglet

Code

Example 1: default font

# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("CodeSnail")
print(result)

Output

Example 2: speed font


–>
# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("CodeSnail", font="speed")
print(result)

Output

text to ascii text art in python

Example 3: 3-d font

# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("CodeSnail", font="3-d")
print(result)

Output

text to ascii python

Example 4: pyramid font

# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("CodeSnail", font="pyramid")
print(result)

Output

–>
pyfiglet examples to generate ascii art

Example 5: weird font

# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("CodeSnail", font="weird")
print(result)

Output

pyfiglet text to ascii

Example 5: alligator font

# import pyfiglet module
import pyfiglet result = pyfiglet.figlet_format("WOW", font="alligator")
print(result)

Output

ascii text in python

lots of fonts right. There are others too.

–>

How to get all list of fonts in pyfiglet?

Type this in a terminal, it will show all the fonts you can use.

pyfiglet -l

or

pyfiglet --list_fonts

In a python file, you can get a fonts list

# import pyfiglet module
import pyfiglet
print(pyfiglet.FigletFont.getFonts())

And you get all list of fonts.

Must try this module to generate text to ASCII art. Follow me on Instagram @code_snail

–>

You may also like,



Source: https://www.codesnail.com/text-to-ascii-art-using-python/

How to resolve dependencies in .NET APIs based on current HTTP Request Previous post How to resolve dependencies in .NET APIs based on current HTTP Request
JavaScript “sub-string” Next post JavaScript “sub-string”

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.