import urllib.request
#导入模块
url="路径"
#路径file=("值1","值2")
#伪装成浏览器值dom=urllib.request.build_opener()dom.addheaders=[file]her=dom.open(url).read()tc=open("D:hom.txt","wb")tc.write(her)tc.close()
#最后是写入文件