版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xu187/article/details/53785141
#判断两个文件是否互为新旧两个版本
def contrastTwoFile(oldSpcial_file_dir,newSpcial_file_dir): f_1 = file(oldSpcial_file_dir) s1 = json.load(f_1) f_2 = file(newSpcial_file_dir) s2 = json.load(f_2) value1 = s1["label"] value2 = s2["label"] if s1["label"]["en"]==s2["label"]["en"] : return s1["label"]["en"]
#遍历旧版本目录下的所有文件 for oldRoot, oldSub_dirs, oldFiles in os.walk(oldSource_dir): for oldSpecial_file in oldFiles:
#得到文件后缀名 oldSufix = os.path.splitext(oldSpecial_file)[1][1:] if oldSufix != "json" : continue #得到旧版本文件路径 oldSpcial_file_dir = os.path.join(oldRoot, oldSpecial_file)