import os
from PIL import Image
import shutil
direct = os.scandir('家')
for file in direct:
im = Image.open(file.path)
x, y = im.size
if x/y == 3/4 or x/y == 4/3:
shutil.copy(file.path, "三比四/")
# os.rename(file.path, "三比四/%s" % file.name) 一直报错
else:
shutil.copy(file.path, '其他/')
# os.rename(file.path, '其他/%s' % file.name) 一直报错
网友评论