python的正则与网页操作练习二:importre
importurllib.request
#51ctourlcode=gb18030
classdown51web:
s_url=‘‘
s_blogid=‘‘
s_blogpages=‘‘
s_html=‘‘
s_code=‘‘
def__init__(self,url,code):
self.s_url=url
self.s_code=code
defget_html(self):
self.s_html=urllib.r..
分类:
编程语言 时间:
2014-08-01 00:14:21
阅读次数:
334
import?urllib.request
#jk409??2014-7-31?by?python3.4编写用于[批量]查询IP地址国家区域
def?chaxun(ip_addr):
????ip_addr2=ip_addr
????domain_addr=‘http://ip.taobao.com/service/getIpInfo...
分类:
编程语言 时间:
2014-07-31 17:23:27
阅读次数:
251
正则表达式与python的网页操作练习一:importurllib.request
importre
qname=input(‘inputenglish:‘)
qname=qname.strip()
url=‘http://dict.youdao.com/search?le=eng&q=‘+qname+‘&keyfrom=dict.top‘
html=urllib.request.urlopen(url)
source=html.read().decode(‘U..
分类:
编程语言 时间:
2014-07-31 17:21:47
阅读次数:
242
其实这些东西好像不用这样获取的,中国天气网上直接提供有天气的json数据接口,
不过最近想弄一个一键新闻或者其它例如糗百、微博热点、QQ热点聚合的东西。
先拿天气来练练手
其实这个不用模拟登陆,所以非常简单,上代码:
# -*- coding: utf-8 -*-
import urllib
import re
import thread
class Wathereather_...
分类:
编程语言 时间:
2014-07-31 13:20:16
阅读次数:
264
以前的python2.x的时候:
try:
fp=urllib.request.urlopen(blogurl)
except Exception, e:
print (e)
print('download exception %s' % blogurl)
return 0
现在python3.x的时候:
...
分类:
编程语言 时间:
2014-07-29 14:58:28
阅读次数:
279
/** author: insun title:python 爬虫抓取心得分享 blog:http://yxmhero1989.blog.163.com/blog/static/112157956201311821444664/ **/??? 0x1.urllib.quote(‘要编码的字符串‘) 如果你要在url请求里面放入中文...
分类:
编程语言 时间:
2014-07-26 03:36:37
阅读次数:
334
之前使用scrapy实现了一个超级简单的爬虫工具,用于抓取豆瓣上面所有的编程书籍信息(由于不需要爬取整个页面的所以链接,所以不需要用到BFS or DFS,只实现顺序抓取下一页) 这次使用的是python自带的urllib 和urllib2等python模块实现,同样以豆瓣上面的爱情电影信息作...
分类:
编程语言 时间:
2014-07-22 22:47:35
阅读次数:
347
#!/usr/bin/env python# -*- coding: utf-8 -*-import sys,reimport urllib.request,urllib.parse,http.cookiejarclass myW3(): def login(self): 'post 数据' dat...
分类:
编程语言 时间:
2014-07-21 08:22:06
阅读次数:
354
由于python目前不能直接处理中文路径,必须要转化一下,如下例子是下载图片(名字为中文的): def getInfo(self,imageurl): response = urllib.request.urlopen(imageurl).read().decode('utf-8')# with o...
分类:
编程语言 时间:
2014-07-21 08:09:58
阅读次数:
210