#本脚本用来将两个文件夹下的文件进行同名,但是后缀不一样;作者:pwj-2022-4-19
import os
import re
#path = input('请输入文件路径(结尾加上/):')
pathimage = "lanedata/img12_distoration/image/"
pathlable = "lanedata/img12_distoration/label/"
# 获取该目录下所有文件,存入列表中
fileListimage = os.listdir(pathimage)
fileListlable = os.listdir(pathlable)
n = 0
nn = 426
for i in fileListimage:
# 设置旧文件名(就是路径+文件名)
oldnameimage = pathimage + os.sep + fileListimage[n] # os.sep添加系统分隔符
trimage = re.sub(u"([^\u0030-\u0039])", "", fileListimage[n])
for