您的位置:首页 > 编程语言 > Python开发

Python爬虫(2)--BeautifulSoup的使用

2017-07-28 14:50 316 查看
# -*- coding: utf-8 -*-
import urllib
from bs4 import BeautifulSoup

url = "http://www.baidu.com"
page = urllib.urlopen(url)
soup = BeautifulSoup(page,"html.parser")
print soup
# -*- coding: utf-8 -*-from bs4 import BeautifulSouphelloworld = '<p>Hello World</p>'soup_string = BeautifulSoup(helloworld, "html.parser")print soup_string 
先安装:http://www.crummy.com/software/BeautifulSoup/bs4/download/4.3/beautifulsoup4-4.3.2.tar.gz

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐