Skip to content

Commit

Permalink
split name into sub-parts
Browse files Browse the repository at this point in the history
  • Loading branch information
jlev committed Jun 14, 2016
1 parent 1652173 commit b473bd9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions scraper.py
Expand Up @@ -17,7 +17,11 @@
if index == 0:
gov['state_name'] = line
if index == 1:
gov['name'] = line.replace('Office of Governor ', '')
name = line.replace('Office of ', '')
name_parts = name.split(' ')
gov['title'] = name_parts[0]
gov['first_name'] = ' '.join(name_parts[1:-1])
gov['last_name'] = name_parts[-1]
if index == 2:
gov['address_1'] = line
if index in [3, 4, 5]:
Expand Down Expand Up @@ -47,7 +51,7 @@

# cleanup aura
if gov['state'] == 'CA':
gov['name'] = gov['name'].replace('Edmund Brown', 'Jerry Brown')
gov['first_name'] = gov['first_name'].replace('Edmund', 'Jerry')

governors.append(gov)

Expand Down

0 comments on commit b473bd9

Please sign in to comment.