码迷,mamicode.com
首页 >  
搜索关键字:urlopen    ( 699个结果
python(二) sanurllib2.URLError
1.URLErrorimporturllib2ifname==‘main‘:url=‘http://www.567.com‘req=urllib2.Request(url)try:response=urllib2.urlopen(req)#printresponsehtml=response.read().decode(‘utf-8‘)printhtmlexcepturllib2.
分类:编程语言   时间:2018-10-12 19:28:43    阅读次数:203
Python爬虫3-----Urllib库的基本使用1
什么是Urllib Urllib是python内置的HTTP请求库包括以下模块urllib.request 请求模块urllib.error 异常处理模块urllib.parse url解析模块urllib.robotparser robots.txt解析模块 urlopen 关于urllib.re ...
分类:编程语言   时间:2018-10-12 17:03:29    阅读次数:215
初识装饰器
杂记: import time #调包 time.time() #查看起始时间或者结束时间 time.clock() #查看起始时间或者结束时间 time.sleep #停止多少秒后开始运行代码 import urllib #用于读取网上服务器的数据 from urllib.urlopen impo ...
分类:其他好文   时间:2018-10-08 19:38:50    阅读次数:171
urllib获取get/post请求
from urllib.request import urlopenfrom urllib.parse import urlencode获取get请求# url='http://www.nnzhp.cn'# res=urlopen(url)# print(res.read().decode())二、 ...
分类:Web程序   时间:2018-10-04 11:38:41    阅读次数:165
python (一)
1、查找网页utf编码importurllibifname==‘main‘:req=urllib.urlopen(‘自己想查看的网址‘)html=req.read()dehtml=html.decode(‘utf-8‘)printdehtml2、自动获取网页编码安装chardetpython-mpipinstallchardetimporturllibimportchardetif
分类:编程语言   时间:2018-09-30 16:31:50    阅读次数:161
python里urllib2库的使用
如何使用以及常见方法补充 data = urllib2.urlopen(url).read().decode("gbk", "ignore").encode("utf8", "ignore") 获取远程 url的数据,创建一个表示远程url的类文件对象,然后像本地文件一样操作这个类文件对象来获取远程 ...
分类:编程语言   时间:2018-09-30 14:43:44    阅读次数:165
Python3:urllib模块的使用
Python3:urllib模块的使用1.基本方法 直接用urllib.request模块的urlopen()获取页面,page的数据格式为bytes类型,需要decode*()解码,转换成str类型。 2.使用Request urllib.request.Request(url, data=Non ...
分类:编程语言   时间:2018-09-30 12:46:02    阅读次数:157
Urllib库
urllib是一个包,这个包收集了几个用于处理URLs的模块 请求练习 import urllib.request response = urllib.request.urlopen("http://www.baidu.com") print(response.read().decode("utf- ...
分类:Web程序   时间:2018-09-29 21:35:40    阅读次数:220
python3 raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 403: Forbid
1.分析: 如果用 urllib.request.urlopen 方式打开一个URL,服务器端只会收到一个单纯的对于该页面访问的请求,但是服务器并不知道发送这个请求使用的浏览器,操作系统,硬件平台等信息,而缺失这些信息的请求往往都是非正常的访问,例如爬虫. 有些网站验证请求信息中的UserAgent ...
分类:编程语言   时间:2018-09-29 00:42:12    阅读次数:675
解决 Prometheus 不能获取 Kubernetes 集群上 Windows 节点的 Metrics
背景 接上一篇 "快速搭建 Windows Kubernetes" , 我们发现原来在 Windows Kubernetes 会有一些与在 Linux 上使用不一样的体验,俗称坑,例如 hostAliases。对于我们希望真的把 Windows 放入生产,感觉除了基本的 Pod、Volume、Ser ...
分类:Windows程序   时间:2018-09-28 19:10:15    阅读次数:545
699条   上一页 1 ... 14 15 16 17 18 ... 70 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!