pastebin - collaborative debugging tool
fferen.kpaste.net RSS

Difference between
modified post 24c by Anonymous on Thu 6th Jan 2011 18:48
original post fea41 by Anonymous on Thu 6th Jan 2011 16:46
Download diff
Show old version | new version | both versions

    
1-
import urllib2 as url
1+
import urllib2
22
33
def getBetween(s, e, searched):
44
    sInd = searched.find(s)
55
    return searched[sInd + len(s):searched.find(e, sInd)]
66
77
def get(url):
88
    isHards = []
99
    isbns = []
1010
    done = False
1111
    for pg in xrange(1, 5000):
12-
        html = url.urlopen(url + '?PG=%d' % pg).read()
12+
        html = urllib2.urlopen(url + '?PG=%d' % pg).read()
1313
        eInd = 0
1414
        while True:
1515
            sInd = html.find("<span class='regGray11px'>(", eInd)
1616
            if sInd == -1:
1717
                if eInd == 0:
1818
                    done = True
1919
                break
2020
            eInd = html.find("</span>\n", sInd)
2121
            foo = html[sInd + len("<span class='regGray11px'>("):eInd]
2222
            isHards.append('Hardback' in foo)
2323
            isbns.append(getBetween('ISBN10: ', ';', foo))
2424
        if done:
2525
            break
26-
    return results
26+
    return isHards, isbns
2727
2828
print get('http://www.textbooks.com/Catalog/KMG/Geometry-for-K-12.php')
2929
3030
######
3131
3232
http://www.chartwellyorke.com/fathom/fathomdemos.html
3333
3434
http://isbndb.com/

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at