python 文件批量剪切

import os
from PIL import Image

#批量剪切目录下图片
for j in range(10,121):
    p = 'C:/'+str(j)+'/'   #图片目录
  #  print p
    a = os.listdir(p)
    
    for i in a:
        path = p+i
        print path    #图片名称
        try:
            f = Image.open(path)
    #    print f
        except:

            continue

        else:
            xsize,ysize=f.size
            box=(0,0,xsize,ysize-37)
            f.crop(box).save(path)
   
    

    原文作者:a771948524
    原文地址: https://blog.csdn.net/a771948524/article/details/8974230
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞