checkqcn数据,将完整的qcn重命名,复制到其他文件夹
for file_name in dirs: # 遍历所有文件
# print(file_name)
# print(path_file '\\' file_name)
with open(path_file '\\' file_name, 'rb') as file_object: # 打开文件夹下的每个qcn文件
contents = file_object.read().decode("gbk", 'ignore')
if sn not in contents:#判断sn是否在qcn里
print(sn ' mismatch')
continue
else:
print(sn ' ' file_name)
Txt_write(sn ' ' file_name '\n')#Test.txt中写入sn qcn
shutil.copy(path_file '\\' file_name,r'C:\Users\Administrator\Desktop\ecn' '\\' sn '.qcn')
评论