1 回答
![?](http://img1.sycdn.imooc.com/533e4bec0001ae5302000200-100-100.jpg)
TA贡献1856条经验 获得超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)):
添加回答
举报