python批量修改修改JPG为PNG

import os

files = os.listdir('.')
for f in files:
    x = os.path.splitext(f)
    #判断jpg文件
    if x[1] == ".jpg":  
        #重命名
        name = x[0] + ".png"   
        os.rename(f,name)

猜你喜欢

转载自blog.csdn.net/lw_akeman/article/details/80838124