How to create word art using Python and the pyfiglet library

from pyfiglet import Figlet

def generate_word_art(text, font="standard"):
"""Generates word art for a given text using the specified font.

Args:
text: The text to convert to word art.
font: The font to use for the word art (default: "standard").

Returns:
A string containing the word art.
"""
f = Figlet(font=font)
word_art = f.renderText(text)
return word_art

if __name__ == "__main__":
text = "Hello, Word Art!"
font = "banner3-D" # You can try different fonts like "standard", "shadow", "slant"

word_art = generate_word_art(text, font)
print(word_art)
  _   _      _ _         _             
| | | | ___| | | ___ | | _____ _ __
| |_| |/ _ \ | |/ _ \ | |/ / _ \ '__|
| _ | __/ | | (_) | | < __/ |
|_| |_|\___|_|_|\___/ |_|\_\___|_|

_ _ _ _
| || |___ __ _| |_ ___| | _____ _ __
| || / __|/ / | | __/ _ \ |/ / _ \ '__|
|__ \__ \ / /__| | || __/ < __/ |
|_|___/\____/_|\__\___|_|\_\___|_|

Create a small python code for print word art

Here’s a small Python script to print word art using ASCII characters

from pyfiglet import Figlet

# Initialize Figlet with a font
fig = Figlet(font='slant')

# Input the word
text = input("Enter a word: ")

# Generate and print ASCII art
print(fig.renderText(text))

This script uses the pyfiglet library to generate stylish ASCII text. You can install it using

pip install pyfiglet

Here’s an example of what the output might look like if you enter "HELLO"

  _    _      _ _
| | | | | | |
| |__| | ___| | | ___
| __ |/ _ \ | |/ _ \
| | | | __/ | | (_) |
|_| |_|\___|_|_|\___/

This is generated using the slant font in pyfiglet. You can change the font style by modifying

fig = Figlet(font='slant')  # Try 'block', 'standard', etc.