from os import *
from PIL import Image
PATH = r"C:\Users\Administrator\Desktop"
def convert(list):
wept = path.join(PATH, list)
img = Image.open(wept)
img.load()
img.save(path.join(PATH, list[0:list.rindex('.')] + ".jpg"))
remove(wept)
for root, dirs, files in walk(PATH):
for f in files:
if path.splitext(f)[1] == ".webp": convert(f)
这样呢,现在是15行