将文件夹中的.jsp重命名为.html

import os

def rename(path):
    files = os.listdir(path)

    for file in files:
        dir = os.path.join(path, file)
    # 检测是否为文件夹,如果是,则递归
if os.path.isdir(dir): rename(dir) continue file_split = file.split('.') if file_split[1] == "jsp": new_dir = os.path.join(path,file_split[0]+'.html') os.rename(dir,new_dir) rename(os.path.dirname(__file__))

 

相关文章:

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