def is_archive(file): path = PurePath(file) file_format = PurePath.suffix(path)[1:] supported_filetype = ['.zip', '.rar', '.7zip'] for type_ in supported_filetype: if type_ == file_format: return True else: return False
def is_image(file): path = PurePath(file) file_format = PurePath.suffix(path)[1:] supported_filetype = ['.jpg', '.png'] for type_ in supported_filetype: if type_ == file_format: return True else: return False