'''
actor_movie_table
The following function generates a list of lists consisting of the first table found on a particular
actor's boxofficemojo page

The movie_attribute protion of the code loops through the html table, capturing everything until the
table list generated by beautifulsoup ends

all_movies is the list of lists containing all movies found on the table on the actor's page
'''

def actor_movie_table(actor_page, all_movie_html_block):
    movie_table = []
    all_movies = []
    for x in range(1, len(all_movie_html_block)):
        movie_html_block = all_movie_html_block[x]
        movie_items = []
        for i in range(0, len(movie_html_block.find_all('td'))):
            movie_attribute = movie_html_block.find_all('td')[i].text
            movie_items.append(movie_attribute)
            try:
                movie_html = movie_html_block.find_all('td')[i].a['href']
            except:
                movie_html = ""
            #attribute_info = [movie_attribute, movie_html]
            movie_items.append(movie_html)
        movie_table.append(movie_items+[actor_page])
    all_movies = all_movies + movie_table
    return all_movies