"""
使用说明:
1、在两个path路径下填入地址,!!xml、jpg是两个独立的文件夹!!
2、筛查出多余的xml并提示少xml,不删除。 用作剔除之后的检查工作
"""
import os
path1 = r'D:\Desktop\xin_all1239\jpg'
path2 = r'D:\Desktop\xin_all1239\xml'
def file_name(image_dir,xml_dir):
jpg_list = []
xml_list = []
for root, dirs, files in os.walk(image_dir):
for file in files:
jpg_list.append(os.path.splitext(file)[0])
print(jpg_list)
for root, dirs, files in os.walk(xml_dir):
for file in files:
xml_list.append(os.path.splitext(file)[0])
print(xml_list)
print(len(jpg_list) )
print("jpg" )
print(len(xml_list) )
print("xml" )
diff = set(xml_list).difference(set(jpg_list))
for name in diff:
print("no xml", name + ".xml")
if __name__ == '__main__':
file_name(path1,path2)