网页分析,,from Beautif
网页分析,,from Beautif
from BeautifulSoup import BeautifulSoup import urllib2content = urllib2.urlopen('http://www.xxx').read()htm=unicode(content,'gb2312','ignore').encode('utf-8','ignore')soup = BeautifulSoup(htm)list = soup.find(id='news_sort').find('ul')for i in list.contents: item = i.find('a') if (item): href = item['href'] title = item.string print(title+' '+href)# 先把数据库弄下来,建立模板,把数据填上去#该片段来自于http://byrx.net
相关内容
- Base62,,#filename:ba
- 下载e-hentai的图片~~,,import urlli
- Pymssql学习,对依时利一卡通考勤记录的修改,pymssql一
- python Django 动态 filter 查询数据,pythondjango,在用DJANGO开
- 重命名指定目录文件,重命名指定目录,import ospat
- py关闭显示器,py关闭,py关闭显示器, 更多的
- 插入排序,,伪码请见 Discret
- 冒泡排序(参考Discrete Mathematics and Its Application一书中的
- 上传文件,,<!DOCTYPE ><
- python伪造HTTP-REFERER python自动投票测试,pythonhttp-refere
评论关闭