beautifulsoup 获取特定html源码(无需登录页面) import re
from bs4 import BeautifulSoup
import urllib2 url = 'http://www.cnblogs.com/vickey-wu/'
# connect to a URL
web = urllib2.urlopen(url)
# read html code
html = web.read()
# print html
soup = BeautifulSoup(html,'html.parser')
prety = soup.prettify()
# print prety
pointed_div = soup.findAll(name="div", attrs={"class":re.compile("forFlow")}) # 筛选标签为div且属性class为forFlow的源码
print pointed_div
相关文章
- python 获取html源代码里标签之间的文本用get_text()
- Python 获取Google+特定用户最新动态
- Python+Selenium获取HTML-Table表格数据
- 基于Python的微博旅游情感分析、微博舆论可视化系统-7 源码获取:
- Python获取网页html代码
- Python爬虫 | Beautifulsoup解析html页面
- python爬虫之html解析Beautifulsoup和Xpath
- [转]Python爬虫html解析工具beautifulSoup在pycharm中安装及失败的解决办法
- Python爬虫html解析工具beautifulSoup在pycharm中安装及失败的解决办法
- 使用.format将文本插入到某些HTML代码中,获取错误(Python)