def rename_jpg(root_directory):
    Subdirectorys = glob(root_directory)
    for Subdirectory in Subdirectorys[:]:
        #print(Subdirectory)
        img_path = glob(Subdirectory + "/*.jpeg")
        for img in img_path[:]:
            print(img)
            new_file=img.split(".")[0]+".jpg"
            print(new_file)
            os.rename(img, new_file)

函数rename_jpg中传入的路径为下图的红色框的中的内容python将jpeg的文件重命名为jpg

相关文章:

  • 2021-05-29
  • 2021-09-26
  • 2021-06-18
  • 2021-10-16
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-15
  • 2022-12-23
  • 2021-12-24
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案