This repository has been archived on 2022-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
texty/lib/ascii.py

18 lines
484 B
Python
Raw Normal View History

2022-01-25 17:16:07 +01:00
from tempfile import TemporaryDirectory
from zipfile import ZipFile
from os import listdir
def ascii_art(name):
"""
Returns ASCII by name
"""
a = []
with TemporaryDirectory() as tmpdir:
with ZipFile(f"./assets/{name}.asc","r") as z:
z.extractall(f"{tmpdir}/ascii/{name}")
for f in listdir(f"{tmpdir}/ascii/{name}"):
with open(f"{tmpdir}/ascii/{name}/{f}") as f:
a.append(f.read())
return a