python3.4批量重命名程序封装

出于工作需要写了一个批量重命名的程序,然后试着封装成winexe文件。


import os
print("Welcome to use this program")
print("*"*20)
#执行重命名功能
path = ''
path=input("Please input path: ")
old=""
new=""
old=input("Please input the old filename (only part of it is also accepted): ")
new=input("Please input the new filename: ")
for file in os.listdir(path):
    if os.path.isfile(os.path.join(path,file))==True:
        newname = file.replace(old,new)
        os.rename(os.path.join(path,file),os.path.join(path,newname))

#打印重命名后的文件名列表        
for file in os.listdir(path):
    if os.path.isfile(os.path.join(path,file))==True:
        print(file)
        
print("Succeed")



上午刚好复习了一下input输入,正好用上。

听说pyinstaller封装不错,于是也刚好试了一下。最一开始提示说有错误,原来是缺少一个piwin32组件。去官网下载后再次用cmd运行,然而还是缺少组件。又查找资料把dll文件添加进系统的path环境,最终成功封装。pyinstaller还是需要更多了解

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值