获取页面url,页面url,import reimp
文章由Byrx.net分享于2019-03-23 09:03:10
获取页面url,页面url,import reimp
import reimport urllibimport urllib2from bs4 import BeautifulSoupprint 'nihao'url = "http://zhiqq.com"s = urllib2.urlopen('http://zhiqq.com')s = s.read()htm = unicode(s,'gb2312','ignore').encode('utf-8','ignore')soup = BeautifulSoup(htm)sou = soup.prettify()f = open('C:/Peng,meijie/sou.txt','w')f.write(sou)n = 0for link in soup.find_all('a'): print link.get('href') print n n = n+1#该片段来自于http://byrx.net
相关内容
- 批量文件重命名,,import sysim
- 下妹子图,妹子图,#!/usr/bin/e
- 金山快盘的签到程序,金山签到程序,金山快盘的签到程
- 统计英文词频,英文词频,python2.7适用于
- 谁说使用Python你就写不出混乱的代码?,python代码,下面
- 超大文件中查找特定字符串,中查找字符串,基本需求:
- Python中map filter reduce的递归实现,pythonreduce,map2=lambda
- python 新浪微博登陆,python新浪微博,按照别人blog做的
- 多线程的界面操作,多线程界面操作,# coding=UTF
- 杨辉三角(pascal三角),杨辉pascal三角,def row(x):
评论关闭