Art module in Python
Last Updated :
12 Nov, 2020
Art package is used to print decorative art’s on the terminal as well as to save in file and a word can be represented by ” | “and can be saved in a file
Installation
This module doesn’t come built-in with Python. To install this type the below command in the terminal.
pip install art
Function:
- Printing Normal and random arts on terminal and aprint() function
- Printing a word in form of | and tprint() function also saving it in text/pdf file
Printing art on terminal:
Syntax: art ( name of art, number is integer denoting number of arts in string )
Python3
from art import *
art__0 = art( "woman" ,number = 10 )
print (art__0)
|
Output:
Random generation of arts:
Python3
from art import *
print (art( "random" ))
|
Output:
Using aprint() function
Here, you can directly print arts just like the print function you print something
Python3
from art import *
print ( "Buttterfly by art : " ,end = " " )
aprint( "butterfly" )
print ()
|
Output:
Now Let’s move towards the capability of python text to art
Python3
from art import *
Art = text2art( "GFG" , font = 'block' , chr_ignore = True )
print (Art)
|
Output:
tprint() function is same as print() function it prints the text into ASCII format
Python3
from art import *
tprint( "GFG" , "rnd-xlarge" )
|
Output:
We can save this to a txt file too by using tsave() function.
Syntax: tsave(“STRING”, OUTPUT FILE NAME OR PATH)
Python3
from art import *
Filename = tsave(
"GEEKSFORGEEKS" , filename = "Output_in_txt_file_using_tsave().txt" )
|
Output:
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...