我们在桌面新建一个txt文件把扒下来的html放进去:>>> import urllib2>>> response = urllib2.urlopen("http://www.baidu.com")>>> f = open(r'C:\Users\Administrator\Desktop\scrap...
分类:
Web程序 时间:
2015-11-30 20:00:14
阅读次数:
120
from urllib import requestwith request.urlopen('https://api.douban.com/v2/book/2129650') as f: data = f.read() print('Status:', f.status, f.reas...
分类:
Web程序 时间:
2015-11-30 13:03:36
阅读次数:
222
今天来运行以前的python脚本,结果报这个错:urllib2.URLError: 原来是因为解决方法:打开IE浏览器,依次选择 工具——Internet选项——连接——局域网设置,取消代理服务器复选框坑中之最
分类:
Web程序 时间:
2015-11-24 12:55:15
阅读次数:
239
下载博客园的logofrom urllib.request import urlretrievefrom urllib.request import urlopenfrom bs4 import BeautifulSouphtml = urlopen("http://www.cnblogs.com"...
分类:
编程语言 时间:
2015-11-19 12:38:18
阅读次数:
165
1 __author__ = 'minmin' 2 #coding:utf-8 3 import re,urllib,sgmllib,os 4 5 #根据当前的url获取html 6 def getHtml(url): 7 page = urllib.urlopen(url) 8 ...
分类:
其他好文 时间:
2015-11-13 18:43:00
阅读次数:
297
1 __author__ = 'minmin' 2 #coding:utf-8 3 import re,urllib,sgmllib 4 5 #根据当前的url获取html 6 def getHtml(url): 7 page = urllib.urlopen(url) 8 ht...
分类:
其他好文 时间:
2015-11-13 18:41:10
阅读次数:
250
1 __author__ = 'minmin' 2 #coding:utf-8 3 import re,urllib,sgmllib,os 4 5 #根据当前的url获取html 6 def getHtml(url): 7 page = urllib.urlopen(url) 8 ...
分类:
其他好文 时间:
2015-11-13 18:38:49
阅读次数:
343
1 __author__ = 'minmin' 2 #coding:utf-8 3 import re,urllib,sgmllib 4 5 #根据当前的主页url获取html 6 def getHtml(url): 7 page = urllib.urlopen(url) 8 ...
分类:
其他好文 时间:
2015-11-13 18:24:10
阅读次数:
246
网页抓取:把URL地址中指定的网络资源从网络流中读取出来,保存到本地。在python中,使用urllib2来抓取网页。以urlopen函数的形式提供了一个非常简单的接口函数:urlopen(url, data, timeout) url:网址 data:访问URL时要传送的数据 timeout:设....
分类:
编程语言 时间:
2015-11-01 00:13:43
阅读次数:
202