In the get_industry_urls function, there's this line:
links = soup.fetch("table")[7].fetch("a") This line fetches all the links in table 7. Notice the [7]. This says you want only one item from the list.
A list contains multiple items. It can contain two, three, four or millions of items. But it can also contain just one, or no items whatsoever. It's still a list, regardless of how many items it has. In order to pull a single item from a list, you need to specify it's index.
For instance, if you have a list with a single letter in it:
To get the letter out of the list, you have to specify it's index. Because the list is only one item long, there is only one valid index: 0:
The same thing applies to your links. In order to get the first (and only) element out of a list of links:
single_link = soup.fetch("table")[7].fetch("a")[0] BeautifulSoup provides a shortcut for this type of command, though. The following code is equivalent to the above code:
single_link = soup.fetch("table")[7].a