当前位置:网站首页>JPEG2jpg
JPEG2jpg
2022-08-04 05:29:00 【CV小Rookie】
import os
import string
dir1 = "11/"
dir2 = "test/"
# 读取函数,用来读取文件夹中的所有函数,输入参数是文件名
def read_directory(directory_name):
i=0
for filename in os.listdir(directory_name):
print(filename)
if "DS_Store" in filename:
continue
newname = filename
newname = newname.split(".")
if newname[-1]=="JPEG":
i=i+1
newname[-1]="jpg"
newname[-2]=str(i)
newname = str.join(".",newname) #这里要用str.join
filename = dir1+filename
newname = dir2+newname
os.rename(filename,newname)
read_directory("./11")
边栏推荐
猜你喜欢
随机推荐
MySQL事务详解(事务隔离级别、实现、MVCC、幻读问题)
[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()
flink-sql所有数据类型
oracle临时表与pg临时表的区别
flink自定义轮询分区产生的问题
组原模拟题
flink-sql所有表连接器
【CV-Learning】Image Classification
【go语言入门笔记】13、 结构体(struct)
记一次flink程序优化
(十六)图的基本操作---两种遍历
(十五)B-Tree树(B-树)与B+树
RecyclerView的用法
攻防世界MISC———Dift
Dictionary feature extraction, text feature extraction.
TensorFlow2学习笔记:6、过拟合和欠拟合,及其缓解方案
flink-sql查询配置与性能优化参数详解
Briefly say Q-Q map; stats.probplot (QQ map)
fill_between in Matplotlib; np.argsort() function
(十四)平衡二叉树









