Introduction
We will be using the art library to make ASCII Art in Python. This is a very simple library and also called ASCII art library for Python. ASCII Art is also known as computer text art. It involves the Intelligently arrangement of special characters and characters you type to create visual shapes that span multiple lines of text.
Installation
pip install art
Usage
Importing library
from art import *
Function to use to print ASCII art
tprint()
The first argument of tprint() function is the text we want to print, the second argument is the font name. Click here to check all the available fonts in the art library.
Examples
Example 1:
from art import *
tprint("test")
Output:
_ _
| |_ ___ ___ | |_
| __| / _ \/ __|| __|
| |_ | __/\__ \| |_
\__| \___||___/ \__|
Example 2:
from art import *
tprint("test", font="bulbhead")
Output:
____ ____ ___ ____
(_ _)( ___)/ __)(_ _)
)( )__) \__ \ )(
(__) (____)(___/ (__)
Example 3:
from art import *
tprint("test", font="random")
Output:
. .
.o8 .o8
.o888oo .ooooo. .oooo.o .o888oo
888 d88' `88b d88( "8 888
888 888ooo888 `"Y88b. 888
888 . 888 .o o. )88b 888 .
"888" `Y8bod8P' 8""888P' "888"
Example 4:
from art import *
tprint("test", font="random")
Output:
::::::::::: :::::::::: :::::::: :::::::::::
:+: :+: :+: :+: :+:
+:+ +:+ +:+ +:+
+#+ +#++:++# +#++:++#++ +#+
+#+ +#+ +#+ +#+
#+# #+# #+# #+# #+#
### ########## ######## ###
Example 5:
from art import *
tprint("test", font="random")
Output:
###### ###### #### ######
#
# # #
# ###### # #
# # # #
# # # #
##### ###### #### #####
Example 6:
from art import *
tprint("copyassignment", font="random")
Output:
Example 7:
from art import *
tprint("copyassignment", font="random")
Output:
Example 8:
from art import *
tprint("copyassignment", font="random")
Output:
Conclusion
In this post, we learned how to use Python’s art library to create ASCII Art in Python. We have used the tprint() function to print ASCII art. There are two main arguments(the text we want to print and the font of the text) that we can pass to the tprint() function.
We hope you find this article on “ASCII Art in Python” helpful.
Also Read:
- What is web development for beginners?
- Python | Check Armstrong Number using for loop
- Python | Factorial of a number using for loop
- What does if __name__ == __main__ do in Python?
- Python | CRUD operations in MongoDB
- Create your own ChatGPT with Python
- Radha Krishna using Python Turtle
- Python Programming Examples | Fundamental Programs in Python
- Python | Delete object of a class
- Python | Modify properties of objects
- Python classmethod
- Python | Create a class that takes 2 parameters, print both parameters
- Python | Create a class, create an object of the class, access, and print property value
- Python | Find the maximum element in a list using lambda and reduce()
- Python | filter numbers(that are not divisible by 3 and 4) from a list using lambda and filter()
- Python | lambda function that returns the maximum of 2 numbers
- Python | Convert all strings of a list to uppercase using lambda
- Python | Square numbers of a list using lambda
- Python | Reverse and convert a string to uppercase using lambda
- Python | Convert String to uppercase using lambda
- Python | Reverse a list using lambda
- Python | Calculator using lambda
- Python | Square of a number using lambda
- Python | Multiply numbers using lambda
- Python | lambda with None
- Python | lambda with pass statement
- Python | Add numbers using lambda
- Python | Print Namaste using lambda
- Iterate over a string in Python
- Python | join() | Join list of strings