windows下利用python计算文件md5值

import os,hashlib
def command_shell(file):
    with open(file, "rb") as fd:
        data = fd.read()
    md5sum = hashlib.md5(data).hexdigest()
    return md5sum


file_path=r"D:\work\NLP_transfer\split_code\chunk_2.wav"
print(command_shell(file_path))


file_path=r"D:\work\NLP_transfer\split_code\chunk_3.wav"
print(command_shell(file_path))

centos下利用python查看md5和hadoop上文件md5详情见:

https://blog.csdn.net/weixin_47046791/article/details/131198529?spm=1001.2014.3001.5501

你可能感兴趣的:(python,开发语言)