Python 如果存在无法打开的图像,如何打开图像路径?巨蟒
正如你所见,9.jpg无法打开。 当我使用Python 如果存在无法打开的图像,如何打开图像路径?巨蟒,python,image,python-imaging-library,Python,Image,Python Imaging Library,正如你所见,9.jpg无法打开。 当我使用 im = Image.open(imagepath) 错误: IOError:无法识别图像文件“C:\Desktop\Tom\u Cruise\images\9.jpg” 那么,如何忽略它或如何解决错误 使用试除块绕过IOError怎么样 try: im = Image.open(imagepath) except IOError: print '%s could not be opened' % imagepath 你真的能看到
im = Image.open(imagepath)
错误:
IOError:无法识别图像文件“C:\Desktop\Tom\u Cruise\images\9.jpg”
那么,如何忽略它或如何解决错误
使用
试除块绕过IOError
怎么样
try:
im = Image.open(imagepath)
except IOError:
print '%s could not be opened' % imagepath
你真的能看到这张照片吗?由于没有预览,它可能只是一个损坏的文件(或错误的扩展名),我无法查看此图像。既然img是自动下载的,那么如何解决或忽略这个错误呢website@bob90937我的回答对你有用吗?请自行选择接受答案。