Top Commentators

  • Two guys and a Beer - Episode 85
  • Jam Session 2
  • Two guys and a Beer - Episode 84

Grabbing title tag from web page

At least a couple of options, the first using BeautifulSoup:

import urllib
import BeautifulSoup

soup = BeautifulSoup.BeautifulSoup(urllib.urlopen("https://www.google.com"))
print soup.title.string

And the second one using lxml:

import lxml.html
t = lxml.html.parse(url)
print t.find(".//title").text
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Posterous
  • Reddit
  • Twitter
  • HackerNews
  • FriendFeed
  • Hyves
  • RSS

Related:

  1. Several years of email statistics – code included
  2. Double click/tap detection on android’s MapView

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>