我有以下代码从URL列表中下载HTML内容。每当我运行它时,我会收到一条错误消息“Traceback(最近一次呼叫最后一次):
tan()
这是代码:
test:
[junit] Running CalculatorTest
[junit] Testsuite: CalculatorTest
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 se
c
[junit] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 se
c
[junit]
[junit] Null Test: Caused an ERROR
[junit] CalculatorTest (wrong name: package/CalculatorTest)
[junit] java.lang.NoClassDefFoundError: CalculatorTest (wrong name: package/C
alculatorTest)
我该如何解决这个问题?
答案 0 :(得分:0)
您正在尝试在函数上调用方法而不是对象。而是致电:
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() # instead of m = hashlib.md5
m.update(message)
return m.hexdigest()
hashMessage = computeMD5(url)
print hashMessage
os.system(" wget -O /desktop/Html" + hashMessage + ".txt " + url)