资源简介
checkqcn数据,将完整的qcn重命名,复制到其他文件夹
代码片段和文件信息
import osshutil
def open_qcn(sn):
path_file = r‘C:\Users\Administrator\Desktop\1\1‘
dirs = os.listdir(path_file) # 打开绝对路径的文件夹
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
评论
共有 条评论