from BeautifulSoup import BeautifulSoup
import re
import urllib2
#Create the soup
input = '''<html>
<head><title>Page title</title></head>
<body>
<p id="firstpara" align="center">This is paragraph <b>one</b>.
<p id="secondpara" align="blah">This is paragraph <b>two</b>.
</html>'''
soup = BeautifulSoup(input)

#Search the soup
titleTag = soup.html.head.title
print titleTag



