資源簡介
python對圖片或者文本實現批量重命名,文本數據或者圖片數據都可以。代碼簡單易懂。
代碼片段和文件信息
#?-*-?coding:utf8?-*-
#usage:實現對圖片的批量重命名
#author:Zoutao
#time:2018/2/22
import?os
class?BatchRename():
#定義函數執行圖片的路徑??
????def?__init__(self):
????????self.path?=?‘/home/nvidia/caffe/data/cheb/test/aodi‘
#定義函數實現重命名操作
????def?rename(self):
????????filelist?=?os.listdir(self.path)
????????total_num?=?len(filelist)
????????i?=?101
????????for?item?in?filelist:
????????????if?item.endswith(‘.jpg‘):
????????????????src?=?os.path.join(os.path.abspath(self
- 上一篇:python百度地圖商家爬蟲
- 下一篇:樹莓派聲控腳本python
評論
共有 條評論