视频后缀PDF改MP4
import os current_dir="D:\百度网盘\Download\F-罚丨Z\\" #需要改 file_iterator = os.scandir(current_dir) for file_info in file_iterator: houzhui = file_info.name.split(".") if len(houzhui)>=2: if houzhui[1] == "pdf": name = houzhui[0]+".mp4" name0 = current_dir+file_info.name name1 = current_dir+name os.rename(name0, name1)