當前位置:首頁 » 編程語言 » python給文件重命名

python給文件重命名

發布時間: 2024-11-03 19:30:20

A. python如何實現將一個文件夾裡面的文件重命名並放到另外一個文件夾裡面

#!/usr/bin/envpython
#coding:utf-8

importos
importre
importglob
importshutil

forfileinglob.glob('./a/*.mol'):
basefile=os.path.basename(file)
_,name,_,ext=re.split('_|.',basefile)
shutil.move(file,'./b/%s.%s'%(name,ext))

熱點內容
編程掙錢嗎 發布:2025-08-22 06:31:21 瀏覽:1000
敬請存儲 發布:2025-08-22 06:25:42 瀏覽:609
linuxphp7配置 發布:2025-08-22 06:17:01 瀏覽:414
shellftp腳本 發布:2025-08-22 06:11:57 瀏覽:796
sql資料庫打開 發布:2025-08-22 05:58:36 瀏覽:888
伺服器IP怎麼找回 發布:2025-08-22 05:41:28 瀏覽:606
手機百度怎樣上傳視頻 發布:2025-08-22 05:28:08 瀏覽:832
亂碼源碼 發布:2025-08-22 05:26:41 瀏覽:204
c語言中基本的數據類型 發布:2025-08-22 05:24:25 瀏覽:809
Android資料庫開源 發布:2025-08-22 05:18:02 瀏覽:631