Printing ASCII Art
Printing ASCII Art
You can print ASCII art that is saved in a separate text file easily. It’s just 2 lines of code.
Here the program would open the ASCII art saved into a file called bat.txt and print out.
f= open ('bat.txt','r') print(''.join([line for line in f]))
You might want to create a Python procedure to make it even easier to print out lots of different ascii art files if you are using multiple ASCII art files in your program.
def print_ascii(fn): f= open(fn,'r') print(''.join([line for line in f])) print_ascii('bat.txt') print_ascii('tree.txt')
You can now use this function anywhere in your code to load ascii art files. If you’ve saved your files to a subfolder then you will need to follow the instructions here.
Warning – make sure you save your ASCII art in the same folder as your code.
Animated ASCII Art
Animated ASCII Art Tutorial
If you want to add animated ASCII art to your programs then you can follow this tutorial here:
Can’t access YouTube? Click here for the Google Drive Version
Text to ASCII Art
Text to ASCII Converter
In this tutorial we show you how you can convert text to ASCII art in only 2 lines of code 🙂
Colorful ASCII
Colorful ASCII Art
You can change the colors of text within your programs and you can even make your ASCII art multicolor. Watch this video for a full tutorial on how to do it.