笔记 · · 1281 阅读

读取图片的MD5值

python
targetPath = "G:\\python\\bookschina\\ISBN\\"
    n = 0
    for filename in os.listdir(r""+targetPath+""):  # listdir的参数是文件夹的路径
        print(filename)
        image_file = open(targetPath+filename,'rb').read()
        print(hashlib.md5(image_file).hexdigest())
        if hashlib.md5(image_file).hexdigest() == '0b2e0fcf3c510844b8981bf70afcfdf1':
            n = n + 1
    print(n)