Create Stunning ASCII Art: Python Code to Generate 'Happy Birthday' in Various Font Styles
Install :
pip install pyfiglet
code
import pyfiglet
# Generate ASCII art for "Happy Birthday" using the "slant" font
wish = pyfiglet.figlet_format("Happy Birthday", font="slant")
# Print the ASCII art
print(wish)
- The
pyfiglet
library is imported to use its functionality for generating ASCII art. - The
figlet_format
function is used to create ASCII art from the given text, which in this case is "Happy Birthday". You can change the text to any other phrase you'd like. - The optional
font
parameter is set to "slant" to use the "slant" font style. You can explore other font styles available inpyfiglet
and choose the one that suits your preference. - The generated ASCII art is stored in the
wish
variable. - Finally, the ASCII art is printed using the
print
function.
TRY IT
- "standard" - Standard ASCII font style.
- "slant" - A slightly slanted font style.
- "big" - A font style with bigger characters.
- "block" - A font style with blocky characters.
- "bubble" - A font style with bubbly characters.
- "digital" - A font style resembling digital displays.
- "isometric1" - A font style with isometric characters.
- "alligator2" - A font style with stylized alligator characters.
- "starwars" - A font style resembling the Star Wars logo.
- "roman" - A font style with a Roman-inspired look.