码迷,mamicode.com
首页 > 其他好文 > 详细

分享一下伪装刚学的

时间:2018-05-19 19:09:38      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:close   ade   路径   模块   build   写入   pen   imp   dom   

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

#最后是写入文件

分享一下伪装刚学的

标签:close   ade   路径   模块   build   写入   pen   imp   dom   

原文地址:https://www.cnblogs.com/chunqing/p/9061281.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!