python3 md5对大文件的处理

   2024-10-10 2430
核心提示:import hashlibdef md5_large_file(file_path):md5 = hashlib.md5()with open(file_path, “rb”) as f:for chunk in iter(lambd

import hashlib

def md5_large_file(file_path):md5 = hashlib.md5()with open(file_path, “rb”) as f:for chunk in iter(lambda: f.read(4096), b""):md5.update(chunk)

return md5.hexdigest()

file_path = “large_file.txt”md5_hash = md5_large_file(file_path)print(f"MD5 hash of the file {file_path}: {md5_hash}")

 
举报打赏
 
更多>同类维修大全
推荐图文
推荐维修大全
点击排行

网站首页  |  关于我们  |  联系方式网站留言    |  赣ICP备2021007278号