Source

owen&yufei / 234 / h_parse2.py

The default branch has multiple heads

#!/usr/bin/env python
#coding=utf-8

#导入包
import urllib2
from BeautifulSoup import BeautifulSoup 

#赋值、返回代码、抓取
fetch_url = ('h1.html','r')
html_content = urllib2.urlopen(fetch_url).read()
parsed_html = BeautifulSoup(html_content)

#输出 a,b。b=titile
print '网站名称:', parsed_html.title.text