len + print

This commit is contained in:
Евгений Храмов 2023-06-02 17:50:28 +03:00
parent 55699412ea
commit 4bf547aefd

10
hlna.py

@ -69,7 +69,7 @@ def hlna():
@click.argument('g', nargs=1) @click.argument('g', nargs=1)
@click.option('-d',required=True , help="Путь до zip архива") @click.option('-d',required=True , help="Путь до zip архива")
def restore(g, d): def restore(g, d):
"Получение пути к файлам внутри архива" """Получение пути к файлам внутри архива"""
with zipfile.ZipFile(d, 'r') as zip_file: with zipfile.ZipFile(d, 'r') as zip_file:
files = zip_file.namelist() files = zip_file.namelist()
"Извлечение файлов" "Извлечение файлов"
@ -197,10 +197,12 @@ def print_line(*text, flag="", sep=" ", end="\n"):
color = colorama.Fore.CYAN color = colorama.Fore.CYAN
else: else:
color = colorama.Fore.WHITE color = colorama.Fore.WHITE
len_text = len(*text)+2 len_text = str(*text)
print(colorama.Fore.LIGHTGREEN_EX + "." * len_text) len_text = len_text.split("\n")
max_length = max(len(string) for string in len_text)+2
print(colorama.Fore.LIGHTGREEN_EX + "." * max_length)
print(color, *text, sep=sep, end=end) print(color, *text, sep=sep, end=end)
print(colorama.Fore.LIGHTGREEN_EX + "." * len_text + colorama.Style.RESET_ALL) print(colorama.Fore.LIGHTGREEN_EX + "." * max_length + colorama.Style.RESET_ALL)
def check_int(number=""): def check_int(number=""):