This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from get_info import save_infos | |
from get_imgs import save_imgs | |
if __name__ == '__main__': | |
pth = 'xkcd_save' | |
save_infos(pth) | |
print() | |
save_imgs(pth) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def unit_bytes(bytes: int | float, precision: int = 2, separate: bool = False) -> str | tuple[int | float, str]: | |
"""Divides a number of bytes to a suitable data unit | |
Args: | |
bytes (int | float): the number of bytes to be converted | |
precision (int): the decimal place rounding precision for the output | |
separate (bool): if bytes and unit should be separate values when returned | |
Returns: | |
str | tuple[int | float, str]: the divided bytes rounded to the specified precision of decimal places combined with the data unit |