-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFiglet.py
More file actions
28 lines (23 loc) · 694 Bytes
/
Figlet.py
File metadata and controls
28 lines (23 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
import pyfiglet
def main():
# Handle command-line arguments
if len(sys.argv) == 1:
font = "standard" # Default font
elif len(sys.argv) == 3 and sys.argv[1] == "-f":
font = sys.argv[2] # User-specified font
else:
print("Usage: python figlet.py [-f fontname]")
sys.exit(1)
# Get user input
text = input("Input: ")
try:
# Generate ASCII art with the specified font
ascii_art = pyfiglet.figlet_format(text, font=font)
print("Output:")
print(ascii_art)
except pyfiglet.FontNotFound:
print("Error: Font not found.")
sys.exit(1)
if __name__ == "__main__":
main()