python - 批量更改文件名(过滤掉某个字符串)
发布日期:2021-06-30 19:51:19 浏览次数:3 分类:技术文章

本文共 327 字,大约阅读时间需要 1 分钟。

import ospath = 'F:\电影\xxx'drop_str = '【支付宝:xxx 打赏一元 有惊喜哟】'items = os.listdir(path)os.chdir(path)print(os.getcwd())for name in items:    print(name)    new_name = ''.join(name.split(drop_str))    os.rename(name, new_name)print('-----------------分界线--------------------')items = os.listdir(path)for name in items:    print(name)

转载地址:https://lipenglin.blog.csdn.net/article/details/78071308 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:python 数据科学 - 【分类模型】 ☞ 决策树
下一篇:python 数据科学 - 【回归分析】 ☞ 线性回归(2)

发表评论

最新留言

做的很好,不错不错
[***.243.131.199]2024年04月25日 15时24分38秒