for rownumber, row in enumerate(rows):
    if row.get_text() == 'Nascimento':
        birthinfo = rows[rownumber + 1].getText().split('\n')
try:
    d[senator]['birthplace'] = birthinfo[1]
except IndexError:
    d[senator]['birthplace'] = ''
birth = re.search('(.*\\d{4}).*\\((\\d{2}).*\\)', birthinfo[0])
d[senator]['birthdate'] = birth.group(1)
d[senator]['age'] = birth.group(2)
if row.get_text() == 'Partido':
    d[senator]['party'] = rows[rownumber + 1].getText()
if 'Profiss' in row.get_text():
    d[senator]['profession'] = rows[rownumber + 1].getText()
How to scrape data from multiple wikipedia pages with python?