1 回答

TA貢獻1856條經(jīng)驗 獲得超5個贊
而不是這個:
for (dirpath, dirnames, filenames) in os.walk(path):
for files in filenames:
if (dic.get('Directory') == path
and dic.get('Filename') == get_filename(files)
and dic.get('File Size') == get_filesize(files)
and dic.get('Hash') == get_md5(files)):
你應該使用過:
for root, dirs, files in os.walk(path):
for f in files:
file_name = os.path.join( root, f ) # <<--- this is important
if (dic.get('Directory') == path # `root` here, not `path` ??
and dic.get('Filename') == get_filename(file_name)
and dic.get('File Size') == get_filesize(file_name)
and dic.get('Hash') == get_md5(file_name)):
添加回答
舉報