码迷,mamicode.com
首页 >  
搜索关键字:urlopen    ( 699个结果
python获取指定网页上的有多少个超级链接
#-*-coding:cp936-*-importurllib2importredefu(url):#connecttoaURLwebsite=urllib2.urlopen(url)#readhtmlcodehtml=website.read()#usere.findalltogetallthel...
分类:编程语言   时间:2014-12-05 12:27:16    阅读次数:122
Python urllib模块urlopen()与urlretrieve()详解
Python urllib模块urlopen()与urlretrieve()的使用方法详解。1.urlopen()方法urllib.urlopen(url[, data[, proxies]]) :创建一个表示远程url的类文件对象,然后像本地文件一样操作这个类文件对象来获取远程数据。参数url表示...
分类:编程语言   时间:2014-11-19 18:07:26    阅读次数:186
python批量下载色影无忌和蜂鸟的图片 爬虫小应用
# -*- coding:utf-8 -*- import re,urllib,sys,os,time def getAllUrl(): entry=sys.argv[1] #try: getPage=urllib.urlopen(entry).read() #except: # print "Error" pattern=re.compile(r'') web_site_p...
分类:编程语言   时间:2014-11-17 17:55:13    阅读次数:304
用Python抓网页的注意事项
用Python编一个抓网页的程序是非常快的,下面就是一个例子:import urllib2 html = urllib2.urlopen('http://blog.raphaelzhang.com').read()但是在实际工作中,这种写法是远远不够的,至少会遇到下面几个问题:网络会出错,任何错误都...
分类:编程语言   时间:2014-11-15 16:44:29    阅读次数:535
python获取外网地址
1 # coding=gbk2 import sys,urllib.request,re3 4 url = "http://www.3322.org/dyndns/getip" #网页地址5 myPage=urllib.request.urlopen(url).read()6 myPage = my...
分类:编程语言   时间:2014-11-07 14:20:01    阅读次数:238
python——3.x的异常处理 请注意了
以前的python2.x的时候:try:fp=urllib.request.urlopen(blogurl)exceptException,e:print(e)print('downloadexception%s'%blogurl)return0现在python3.x的时候:try:fp=urlli...
分类:编程语言   时间:2014-11-02 10:44:11    阅读次数:209
python urllib相关学习
#-*-coding:-utf-8importurllib#url='http://iplaypython.com/'#url1=urllib.urlopen(url)#打开url地址,urlopen(url,data=None,proxies=None)#printurl1.read()#读取re...
分类:编程语言   时间:2014-10-29 01:56:32    阅读次数:323
Python Challenge 3~5
第3关 ORZ,又是源代码。开启正则表达式。from urllib import *from urllib.request import *import reres = urlopen('http://www.pythonchallenge.com/pc/def/equality.html')li....
分类:编程语言   时间:2014-10-26 19:33:43    阅读次数:215
urllib url后面传长数据
用给自己记录用defmonitor_work_1(content):dict_1={‘service‘:‘rdc_monitor‘,‘checkpoint‘:‘rdc_monitor_log‘,‘title‘:content,‘content‘:content,‘cluster‘:‘public‘,‘grade‘:‘2‘}params=urllib.urlencode(dict_1)urllib.urlopen(‘http://alert.sae.sina.com.cn/new/‘,params)
分类:Web程序   时间:2014-10-21 19:49:41    阅读次数:168
Why should i use url.openStream instead of of url.getContent?
I would like to retrieve the content of a url. Similar to pythons:html_content = urllib.urlopen("http://www.test.com/test.html").read()In examples(jav...
分类:Web程序   时间:2014-10-18 15:21:48    阅读次数:232
699条   上一页 1 ... 64 65 66 67 68 ... 70 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!