0
我有以下代码来从URL列表中下载HTML内容。每当我跑我得到它,说:“回溯(最近通话最后一个)的错误:AttributeError:...对象没有属性'更新'
File "*******", line 16, in <module>
**hashMessage = computeMD5(url)**
File "*******", line 13, in computeMD5
**m.update(message)**
*AttributeError: 'builtin_function_or_method' object has no attribute 'update'*
这里是代码:
import hashlib
from hashlib import md5
import os
fh = open("****.txt", 'r')
for line in fh:
url = line
url = url.replace('\n', '')
def computeMD5(message):
m = hashlib.md5
m.update(message)
return m.hexdigest()
hashMessage = computeMD5(url)
print hashMessage
os.system(" wget -O /desktop/Html" + hashMessage + ".txt " + url)
我怎样才能解决这个
'hashlib.md5'应该是'hashlib.md5()' –
@P eterWood您是指“m = hashlib.md5”这一行吗? – BCarey