当前位置:网站首页>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")
边栏推荐
- Kubernetes基本入门-名称空间资源(三)
- postgresql中创建新用户等各种命令
- SQL练习 2022/6/30
- [Deep Learning 21 Days Learning Challenge] 1. My handwriting was successfully recognized by the model - CNN implements mnist handwritten digit recognition model study notes
- SQL练习 2022/7/5
- PostgreSQL模式(Schema)
- ISCC2021———MISC部分复现(练武)
- Kubernetes基础入门(完整版)
- 剑指 Offer 2022/7/5
- 线性回归02---波士顿房价预测
猜你喜欢
随机推荐
sql中group by的用法
Install dlib step pit record, error: WARNING: pip is configured with locations that require TLS/SSL
SQL练习 2022/7/1
oracle临时表与pg临时表的区别
Usage of RecyclerView
Delphi-C side interesting menu operation interface design
flink on yarn指定第三方jar包
SQL练习 2022/7/2
(十五)B-Tree树(B-树)与B+树
双重指针的使用
yolov3数据读入(二)
postgres 递归查询
(十四)平衡二叉树
简单明了,数据库设计三大范式
【深度学习21天学习挑战赛】0、搭建学习环境
【CV-Learning】卷积神经网络预备知识
【go语言入门笔记】12、指针
yolov3 data reading (2)
WARNING: sql version 9.2, server version 11.0.Some psql features might not work.
智能合约安全——delegatecall (2)