Created
September 18, 2016 06:53
-
-
Save foolhorse/5b9b74243085ce1e441ef7f917961b00 to your computer and use it in GitHub Desktop.
check image file type in current dir
This file contains 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
#!/usr/bin/env python2 | |
#-*-encoding:utf-8-*- | |
import os,sys | |
import imghdr | |
list = os.listdir('.') | |
for file in list: | |
filepath = os.path.join('.',file) | |
if os.path.isdir(filepath): | |
pass | |
else: | |
try: | |
print(imghdr.what(file) + ' '+file) | |
except TypeError: | |
print('TypeError'+ ' '+file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment