#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 2 18:23:03 2019
@author: austin
"""
import os
path = '/Users/austin/Desktop/唐书pdf_20190802' #由于这里是当前路径,所以需要把这个代码文件和你要处理的文件放到同一个文件夹里
files = os.listdir(path)
for f in files:
oldname = path+'/'+f
newname = path+'/'+f.replace('-','',2)
# print(f.replace('-','',2))
# print(newname)
os.rename(oldname, newname)
网友评论