我想读取文件中的find md5文件并在mac中复制文件。 但是,我没有得到这样的文件或目录错误。我的代码如下:在mac中通过python读取文件夹中的文件
import os
import hashlib
def md5bul (dosyayolu):
try:
BLOCKSIZE = 65536
hasher = hashlib.md5()
with open(dosyayolu, 'rb' 'utf8') as afile:
buf = afile.read(BLOCKSIZE)
while len(buf) > 0:
hasher.update(buf)
buf = afile.read(BLOCKSIZE)
print(hasher.hexdigest())
except IOError, e:
print ' Error %s' %e
root = '/Users/username/'
for path, subdirs, files in os.walk(root):
for name in files:
dosya = path+name
md5bul (path,name)
print os.path.join(path, name)
但是,我得到以下错误信息;
[Errno 2] No such file or directory:
我不understant为什么我收到此错误信息
你实现代码的错误?