def get_file_type(f_path):
"""
Get the Blib type of a file.
Args:
f_path (str): Path to the file to be checked.
Returns:
str or None
A string containing the Blib type is returned,
if no valid type is found, None is returned.
"""
try:
archive = zf.ZipFile(f_path, 'r')
except zf.BadZipFile:
return None
try:
blib_type = archive.comment.decode("utf-8").split(" ")[1]
except ValueError:
return None
archive.close()
return blib_type
评论列表
文章目录