一个简单的爬虫,简单爬虫,import urlli
一个简单的爬虫,简单爬虫,import urlli
import urllib#读出一个URL下的a标签里href地址为.html的所有地址content = urllib.urlopen('http://www.hoopchina.com').read()s1=0while s1>=0: begin = content.find(r'<a',s1) m1 = content.find(r'href=',begin) m2 = content.find(r'>',m1) if(content[m1:m2].find(r'.html')!=-1): m2 = content.find(r'.html',m1) url = content[m1+6:m2+5] print url s1=m2#该片段来自于http://byrx.net
相关内容
- 生成4位字母数字组合密码字典,4位密码字典,f=open("
- 域名转IP 2种方法,域名转ip2种,#!/usr/local
- Django 模板中使用css, javascript,djangocss,(r'^css/(?P<
- python在Windows8下获取本机ip地址,pythonwindows8,import sock
- python 自动重启本程序,python重启程序,#!/usr/local
- 循环处理序列中的值,循环处理序列,#!/usr/bin/p
- python一句话将数组中的全部字符串转换成小写,python小
- Plots data points and the fitting polynomial using Python,plotspoly
- 使用Python读取和写入mp3文件的id3v1信息,pythonid3v1,#enc
- python解《十滴水》游戏算法,python《十滴水》,# -*- co
评论关闭