View Single Post
Old Nov 16th, 2006, 11:31 PM   #1
nytrokiss
Newbie
 
Join Date: Oct 2006
Posts: 23
Rep Power: 0 nytrokiss is on a distinguished road
Red face Retaining the contents of a list during a recursive function

def find_all_items(site):
    site = urllib.urlopen(site).read()
    all_items = re.findall(r'watch\.asp\?\w+\=\w*\&\w*\=\w+',site)
    next_page = re.findall(r'Watches\.asp\?\w+\=[0-9]+\&pg\=\w+',site)
    try:
        find_all_items(urllib.basejoin("<some url>",next_page[0]))
    except IndexError:
        pass
    return remove_dups(all_items) # ,<---- this removes all the duplicate items


How do i keep the value of all_items that i have within the first function call and return a list of all the items at once also from the second function call

Now the list is being overwritten
nytrokiss is offline   Reply With Quote