height_weight_position = [] for row in wiz_per_game.find_all('tr')[1:]: player = {} # Parsing html data from each player's specific web page player_url = ('https://www.basketball-reference.com/' + row.find('a').attrs['href']) player_rest = requests.get(player_url) player_soup = BeautifulSoup(player_rest.content, 'lxml') player_info = player_soup.find(name = 'div', attrs = {'itemtype' : 'https://schema.org/Person'}) # Adding name for clarity player['Name'] = row.find('a').text.strip() # Using RegEx to extract height, weight, and position from each player's web profile. # The '(.*)' regex notation allows the extraction of text from in between two known substrings, # which is the text written on either side of '(.*)' in the below code. s = str(player_info.find_all('p')) weight = re.search('\"weight\">(.*)lb', s) position = re.search('Position:\n \n (.*)\n\n', s) height = re.search('\"height\">(.*),\xa0