分享一下伪装刚学的

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()

#最后是写入文件

猜你喜欢

转载自www.cnblogs.com/chunqing/p/9061281.html