-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrints.py
25 lines (22 loc) · 815 Bytes
/
Prints.py
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
def show_percent_by_total(total, count_number):
same_line = False if total == count_number else True
pt("Total Size", total, same_line=same_line)
pt("Count number", count_number, same_line=same_line)
progress = float(((count_number * 100) / total))
progress = "{0:.3f}".format(progress)
pt("Progress percent", progress + "%", same_line=same_line)
def pt(title=None, text=None, same_line=False):
"""
Use the print function to print a title and an object converted to string
:param title:
:param text:
"""
if text is None:
text = title
title = '-------------------------------------'
else:
title += ': '
if same_line:
print(str(title) + str(text), end="\r")
else:
print(str(title) + " \n " + str(text))