| nytrokiss |
Nov 19th, 2006 11:12 PM |
Ok now that you see everything in diffrent steps i will show it in all and ones and please refer to the screen shot the code is
:
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
:
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
:
>>> 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??
|