您现在的位置是:主页 > news > jsp和.net做网站的区别/排名优化公司哪家靠谱

jsp和.net做网站的区别/排名优化公司哪家靠谱

admin2025/5/25 13:57:10news

简介jsp和.net做网站的区别,排名优化公司哪家靠谱,义乌营销型网站建设,seo图片优化平时学生交上机作业的时候经常有人相互复制,直接改文件名了事,为了能够简单的检测这种作弊行为,想到了检测文件的MD5值,虽然对于抄袭来说作用不大,但是聊胜于无,以后可以做一个复杂点的。 # coding: utf8i…

jsp和.net做网站的区别,排名优化公司哪家靠谱,义乌营销型网站建设,seo图片优化平时学生交上机作业的时候经常有人相互复制,直接改文件名了事,为了能够简单的检测这种作弊行为,想到了检测文件的MD5值,虽然对于抄袭来说作用不大,但是聊胜于无,以后可以做一个复杂点的。 # coding: utf8i…

平时学生交上机作业的时候经常有人相互复制,直接改文件名了事,为了能够简单的检测这种作弊行为,想到了检测文件的MD5值,虽然对于抄袭来说作用不大,但是聊胜于无,以后可以做一个复杂点的。

# coding: utf8import hashlib
import os
from collections import Counter
import sysreload(sys)
sys.setdefaultencoding('utf-8')def get_md5_01(file_path):md5 = Noneif os.path.isfile(file_path):f = open(file_path,'rb')md5_obj = hashlib.md5()md5_obj.update(f.read())hash_code = md5_obj.hexdigest()f.close()md5 = str(hash_code).lower()return md5def get_md5_02(file_path):f = open(file_path,'rb')  md5_obj = hashlib.md5()while True:d = f.read(8096)if not d:breakmd5_obj.update(d)hash_code = md5_obj.hexdigest()f.close()md5 = str(hash_code).lower()return md5if __name__ == "__main__":output_list=[]#input_path=r"e:\xx\新建文件夹"#output_path = unicode(input_path , "utf8")output_path=os.getcwd()g = os.walk(output_path)  for path,dir_list,file_list in g:  for file_name in file_list:output_list.append(os.path.join(path, file_name) )md5_list= [get_md5_01(i) for i in output_list]Counter_list=Counter(md5_list)for i in Counter_list.items():if i[1] >1:duplicate_list=[ a for a in range(len(md5_list)) if md5_list[a] == i[0]]print '-'*50print i[0]for j in duplicate_list:with open('duplicate.log', mode='a+') as f:f.write(i[0]+'\t'+output_list[j]+'\n')print output_list[j]