CrunchBang Linux Pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

CrunchBang Linux Pastebin

Difference between
modified post 128 by iggykoopa on Mon 26th Jan 03:51 and
original post 126 by iggykoopa on Mon 26th Jan 02:47
Show old version | new version | both versions

    
11
#!/usr/bin/env python
33
import urllib2
44
from BeautifulSoup import BeautifulSoup
66
address = "http://distrowatch.com/"
77
try:
88
    website = urllib2.urlopen(address)
99
    soup = BeautifulSoup(''.join(website))
10-
    rankings = soup.find(text= "Page Hit Ranking").parent.parent.parent.find(text="CrunchBang").parent.parent.parent.find("th").string
10+
    rankings = soup.find(text= "Page Hit Ranking").findParent("table").find(text="CrunchBang").findParent("tr").find("th").string
1111
    print rankings
1212
except:
1313
    print "Not Available"

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me