当前位置:网站首页>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")
边栏推荐
猜你喜欢

多项式回归(PolynomialFeatures)

TensorFlow2 study notes: 8. tf.keras implements linear regression, Income dataset: years of education and income dataset

flink-sql大量使用案例

EPSON RC+ 7.0 使用记录一

VScode配置PHP环境

剑指 Offer 2022/7/1
Kubernetes基本入门-集群资源(二)
Kubernetes基本入门-概念介绍(一)

TensorFlow2 study notes: 5. Common activation functions

字典特征提取,文本特征提取。
随机推荐
TensorFlow:tf.ConfigProto()与Session
(十四)平衡二叉树
sql中group by的用法
超详细MySQL总结
flink-sql所有语法详解
ISCC2021———MISC部分复现(练武)
Logistic Regression --- Introduction, API Introduction, Case: Cancer Classification Prediction, Classification Evaluation, and ROC Curve and AUC Metrics
The pipeline mechanism in sklearn
NFT市场以及如何打造一个NFT市场
简单明了,数据库设计三大范式
flink自定义轮询分区产生的问题
TensorFlow2学习笔记:4、第一个神经网模型,鸢尾花分类
剑指 Offer 2022/7/4
两个APP进行AIDL通信
剑指 Offer 2022/7/2
k3s-轻量级Kubernetes
SQL练习 2022/7/1
postgres recursive query
二月、三月校招面试复盘总结(一)
flink-sql查询配置与性能优化参数详解