본문 바로가기
주저리주저리

ASCII Art

by Zeromk2 2020. 2. 6.

텍스트를 커맨드창에서 꾸며주는 모듈이다. 내일 해봐야지~

 

출처:

https://www.devdungeon.com/content/create-ascii-art-text-banners-python?fbclid=IwAR3HXRKLe1zpIxLOonUWq9rUXf7zgtWE_F8rPw37VeNo9qEd73b9DbCgaU0

 

Create ASCII Art Text Banners in Python

ASCII art has a long history in the hacker culture. If you check out any Phrack article and there is almost guaranteed to be some form of ASCII art in there. In this example we are specifically talking about ASCII art fonts that can be used to make banner

www.devdungeon.com

 

Install pyfiglet

Pyfiglet is the module that will convert regular strings in to ASCII art fonts. Simply use pip to install pyfiglet.

pip install pyfiglet

Use pyfiglet command-line tool

Pyfiglet comes with a command-line tool you can use if you don't need to use the Python library. Below we will explain using it in our own Python code. You can use the command-line tool to generate text or to list the available fonts.

# In your shell/command prompt
pyfiglet                    # Print all options
pyfiglet --list_fonts     # List fonts
pyfiglet "Hello world!" # Generate text

Use pyfiglet in Python code

Here is the basic usage for converting text to ASCII art fonts.

 

# pip install pyfiglet
import pyfiglet

ascii_banner = pyfiglet.figlet_format("Hello!!")
print(ascii_banner)

 

# Example output:

The example above uses the default font. There are a lot of fonts available. Run

 

 

728x90

댓글