Skip to content

Commit

Permalink
Merge pull request #52 from anderstogern/patch-1
Browse files Browse the repository at this point in the history
Updated to follow Wikipedias change of h3 to h4
  • Loading branch information
Oros42 committed May 8, 2018
2 parents def53e7 + 7f1a701 commit adbfcb4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mcc-mnc/update_codes.py
Expand Up @@ -46,12 +46,12 @@
try:
if not 'MCC' in t.text:
continue
h3=t.find_previous_sibling("h3")
if not h3 or ' - ' not in h3.text or '[edit]' not in h3.text:
h4=t.find_previous_sibling("h4")
if not h4 or ' - ' not in h4.text or '[edit]' not in h4.text:
continue
h3=h3.text.split(' - ')
country_name=h3[0]
country_code=h3[1][:-6] # rm '[edit]'
h4=h4.text.split(' - ')
country_name=h4[0]
country_code=h4[1][:-6] # rm '[edit]'

for tr in t.find_all('tr'):
td=tr.find_all('td')
Expand All @@ -71,4 +71,4 @@

if mcc_codes:
with io.open('mcc_codes.json', 'w', encoding='utf8') as outfile:
outfile.write(json.dumps(mcc_codes, ensure_ascii=False, encoding="utf-8"))
outfile.write(json.dumps(mcc_codes, ensure_ascii=False, encoding="utf-8"))

0 comments on commit adbfcb4

Please sign in to comment.