TypeError: 'module' object is not callable 原因分析
程序代码:
import urllib.request
from cons import headers
def getUrlList():
req=urllib.request('https://mm.taobao.com/tstar/search/tstar_model.do?_input_charset=utf-8')
req.add_header('user-agent',headers())
html=urllib.urlopen(req,
data='q&viewFlag=A&sortType=default&searchStyle=&searchRegion=city%3A&searchFansNum=¤tPage=1&pageSize=100').read()
print (html)
getUrlList()
错误代码:
D:\programmingtools\anaconda\python.exe D:/programmingtools/pycharmpro/files/201711112013/taobeauty.py
Traceback (most recent call last):
File "D:/programmingtools/pycharmpro/files/201711112013/taobeauty.py", line 13, in <module>
getUrlList()
File "D:/programmingtools/pycharmpro/files/201711112013/taobeauty.py", line 6, in getUrlList
req=urllib.request('https://mm.taobao.com/tstar/search/tstar_model.do?_input_charset=utf-8')
TypeError: 'module' object is not callable
Process finished with exit code 1