[python-win32] RE Explained With screenshot

James Matthews nytrokiss at gmail.com
Mon Nov 20 05:52:01 CET 2006


This is the code i am dealing with..
Code:
def next_page_finder(site):
    site = urlopen(site).read()
    next_site_pages = []
    next_site_pages.extend(findall(r'\?Brand=\d+\&pg=\d+',site))
    new_pages = []
    for _ in next_site_pages:
        new_pages.append(basejoin("http://www.goldwatches.com/watches.asp",_))
    return new_pages

The issue is that when i run the RE
Code:
next_site_pages.extend(findall(r'\?Brand=\d+\&pg=\d+',site))
it returns me an empty list however in the interactive input i run
something akin to it

Code:
>>> from re import findall
>>> from urllib import basejoin,urlopen
>>> site = urlopen("http://www.goldwatches.com/watches.asp?Brand=11").read()
>>> findall(r'\?Brand=\d+\&pg=\d+',site)
Now as you see in the screen shot the interactive interpreter returns
me a list of values however when i run it in regular python i get an
empty list why??


Screen Shot: http://static.flickr.com/109/301613265_484a49929d_o.jpg

http://www.goldwatches.com


More information about the Python-win32 mailing list