добавил много комментариев, везде, кроме Mathematics.py
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
from modules.DB import UseDB
|
||||
from zipfile import ZipFile
|
||||
|
||||
db = UseDB("events")
|
||||
for i in db.find_document({}):
|
||||
print(i)
|
||||
# db.del_document({"name": i["name"]})
|
||||
# db.update_document({"name": "test not bad"}, {"probability": 50})
|
||||
db.update_document({"name": "test bad "}, {"probability": 50})
|
||||
|
||||
def human_read_format(size):
|
||||
if size < 1024:
|
||||
return f"{size}Б"
|
||||
elif size < 1024 * 1024:
|
||||
return f"{round(size / 1024)}КБ"
|
||||
elif size < 1024 * 1024 * 1024:
|
||||
return f"{round(size / (1024 * 1024))}МБ"
|
||||
elif size < 1024 * 1024 * 1024 * 1024:
|
||||
return f"{round(size / (1024 * 1024 * 1024))}ГБ"
|
||||
|
||||
|
||||
with ZipFile('input.zip') as myzip:
|
||||
for i, j in enumerate(myzip.filelist):
|
||||
items = myzip.namelist()[i].rstrip("/").split("/")
|
||||
if myzip.namelist()[i][-1] == "/":
|
||||
print(" " * (len(items) - 1) + items[-1])
|
||||
else:
|
||||
print(f'{" " * (len(items) - 1) + items[-1]} {human_read_format(j.file_size)}')
|
||||
|
||||
Reference in New Issue
Block a user