我想讀取文件中的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爲什麼我收到此錯誤信息
你實現代碼的錯誤?