判断是否为图像文件

def is_image_file(fileName):
    ls = [fileName.endswith(extension) for extension in ['.jpg', '.png', '.jpeg']]
    print(ls)
    print(any(ls))

fileName = '01.jpg'
is_image_file(fileName)

猜你喜欢

转载自blog.csdn.net/weixin_40823740/article/details/115317832